Answer the question
In order to leave comments, you need to log in
Passing props to new Component(el, propsData), why doesn't the click handler from propsData fire?
I create a button component like this
createElButton(options = {}, el) {
let ButtonComponent = Vue.extend(ElButton);
let buttonInstance = new ButtonComponent({
el: el,
propsData: options
});
console.log(buttonInstance);
return buttonInstance;
}
<a class="button" v-on:click="onClick"></a> // что так
<a class="button" v-on:click="clickHandler"></a> // что этак
// не срабатывает
props: {
onClick: { type: Function, default() {} }
}
methods: {
clickHandler() {
console.log('clickHandler called');
this.onClick();
}
}
// clickHandler called в конслои не вываливается
Answer the question
In order to leave comments, you need to log in
And why do it like this, if you can do $emit in @click and already write v-on:click in the parent, as everyone else does?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question