0👍
Seems ok for me, maybe the issue comes from somewhere else. You can check the fiddle where I modified to test the custom event:
https://jsfiddle.net/Mark_f/u06dmhfn/125/
Vue.component('surprise-app', {
template: `<button @click="surprise">Surprise Me!</button>`,
data() {
return {
surprise: '',
};
},
methods: {
surprise() {
this.$emit('formsubmit')
},
},
})
new Vue({
el: '#surpriseApp',
data: {
surpriseMessage: null,
},
methods: {
surpriseMe() {
this.surpriseMessage = 'you got surpried';
},
},
});
However, according to docs, it’s better to use kebab-case for event names.
👤Mark
Source:stackexchange.com