core: #2278 causes kebab case listener not get triggered

Version

3.0.1

Reproduction link

https://codesandbox.io/s/dreamy-khayyam-m06w1?file=/src/App.vue

Steps to reproduce

<foo @my-event-name="callEvent" />
this.$emit('my-event-name') // `callEvent` not triggered

What is expected?

The doc recommends using kebab case for event names, but #2278 breaks this.

https://v3.vuejs.org/guide/component-custom-events.html#event-names

What is actually happening?

After https://github.com/vuejs/vue-next/pull/2278 got merged, my code shown above won’t work.

(You might want to write some tests before merge. Thanks!)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

This works correctly in a reproduction using 3.0.1 global build (https://jsfiddle.net/yyx990803/3scy68d5/1/) and also works on a fresh vue-cli project using 3.0.1. There could be a compiler/runtime version mismatch in your project that doesn’t properly camelize the event when emitting (make sure your @vue/compiler-sfc is also on 3.0.1).

Closing since it’s not reproducible.

Thanks, this was really helpful.

Just updated a project I’m working on to 3.0.2 and ended up here because of events not firing/not being caught - npm update @vue/compiler-sfc fixed that.

This works correctly in a reproduction using 3.0.1 global build (https://jsfiddle.net/yyx990803/3scy68d5/1/) and also works on a fresh vue-cli project using 3.0.1. There could be a compiler/runtime version mismatch in your project that doesn’t properly camelize the event when emitting (make sure your @vue/compiler-sfc is also on 3.0.1).

Closing since it’s not reproducible.

Please open a new issue. This will get drowned out.