Subscribe on changes!

Dynamic event name binding with nullish value not working

avatar
Oct 16th 2020

Version

3.0.1

Reproduction link

https://codesandbox.io/s/vue3-event-bug-pc5ug?file=/src/App.vue

Steps to reproduce

follow the link

What is expected?

no error like vue2, see

https://codesandbox.io/s/vue2-event-kvjlb?file=/src/App.vue:0-476

What is actually happening?

error happened

avatar
Oct 16th 2020

You can use an empty string as a workaround

avatar
Oct 16th 2020

The compiler doesn't actually account for a dynamic non-null value, but I think we still support this, so it's rather a bug.

_createVNode("button", {
  ["on" + _capitalize($options.ev)]: _cache[2] || (_cache[2] = (...args) => ($options.handleClick(...args)))

The compiler should skip adding that prop to the vNode if !$options.ev