【发布时间】:2020-04-30 19:45:12
【问题描述】:
我在我的应用程序中使用 vue-tables2。借助 vue-table2 选项中可用的“模板”属性,我可以修改数据的格式。
示例代码如下
data: {
columns: ['erase'],
options: {
...
templates: {
erase: function (h, row, index) {
return this.test();
}
}
...
},
methods: {
test() {
return 'test';
}
}
}
代码运行良好,但是当我尝试在模板中调用函数时,它显示以下错误
TypeError: this.test is not a function
如何在 vue-table2 模板属性中调用函数?
【问题讨论】:
标签: vuejs2 vue-tables-2