click事件不能动态调用函数, 如下代码, 报错为:
TypeError: _vm.func is not a function
怎么做才可以实现从v-for中动态调用函数给click事件中调用?
<template slot-scope="scope">
<el-button v-for="(item,key) in actionbutton" :key="key" :type="item.type"
:size="item.size"
@click="func(item.value)">
{{ item.label }}
</el-button>
</template>
actionbutton: [
{label: '查看详情', type: 'text', value: 'showDetails', size: 'mini'},
{label: '编辑', type: 'primary', value: 'showEditDialog(scope.$index,scope.row)', size: 'mini'},
{label: '删除', type:'danger', value:'Delfunction(scope.$index,scope.row)', size: 'mini'},
],
问题解决,
将actionbutton中的value改成method,既可。