代码如下:
<template>
<div class="hello">
<button @click="msgShow1">我可以</button>
<p>都是绑定msgShow事件,点击上面的按钮可以,但是点击下面的按钮报错:</p>
<button v-for="(item,index) in btnsDate"
:key="index"
@click="item.fun">{{item.name}}</button>
</div>
</template>
<script>
export default {
name: 'hello',
data(){
return {
btnsDate:[
{id:12001,name:"点击按钮1",fun:"msgShow"},
{id:12002,name:"点击按钮2",fun:"msgShow"},
{id:12003,name:"点击按钮3",fun:"msgShow"}]
}
},
methods:{
msgShow:function(){
alert("asdasd");
}
}
}
</script>
报错1:
[Vue warn]: Error in v-on handler: "TypeError: handler.apply is not a function"
报错2:
TypeError: handler.apply is not a function
请大牛告知原因~