How to emit an event from Vue.js Functional component?

后端 未结 3 974
悲哀的现实
悲哀的现实 2021-02-05 08:30

As the title of the question, this context is not available in the functional component. So if I have to emit an event, how can I do that?

For example in be

3条回答
  •  无人共我
    2021-02-05 08:54

    If you want to pass event listener conditionally you can do it inside functional component template like this:

    v-on="listeners.change ? { change: listeners.change } : null"
    

    The issue of conditionally attaching listeners is discussed here

提交回复
热议问题