Vue.js - Emit event from directive

后端 未结 7 461
北海茫月
北海茫月 2021-02-02 12:37

Is it possible to emit a custom event from the directive in the component to which this directive is attached.

I was expecting it to work as described

7条回答
  •  死守一世寂寞
    2021-02-02 13:31

    The easiest way to do this is just use dispatchEvent on the el like this

    el.dispatchEvent(new Event('change'));
    

提交回复
热议问题