vue 练习 bug

在使用vue slot分发内容时,如果要绑定事件,不能绑定在slot元素上,同样的不能绑定在自定义元素的模板上,只能绑定在html 元素上,才会生效

demo

<my-component v-on:click="functiona()"></my-component>//错误

Vue.component('my-component1',{

template:'<slot name="slot1" v-on:click="functiona()">这是分发内容,在父组件的slot name是slot1时,会替换子组件这里的内容</slot>'//错误

});

原文地址:https://www.cnblogs.com/xiaofenguo/p/6895619.html