leadingOut () {
if (this.choosed.length === 0) {
alert('请至少勾选一项');
} else {
this.$refs.table.exportCsv({
filename: '自定义数据',
columns: this.tableColumns.filter((col, index) => index < 4),
data: this.tableData.filter((data, index) => index < 4)
});
}
报错信息
index.vue?7346:354 Uncaught TypeError: Cannot read property 'exportCsv' of undefined
at VueComponent.leadingOut (eval at 641 (0.4bb8438….hot-update.js:7), <anonymous>:235:25)
at boundFn (eval at <anonymous> (app.js:759), <anonymous>:170:14)
at VueComponent.invoker (eval at <anonymous> (app.js:759), <anonymous>:1743:18)
at VueComponent.Vue.$emit (eval at <anonymous> (app.js:759), <anonymous>:2210:16)
at VueComponent.handleClick (eval at <anonymous> (app.js:4773), <anonymous>:7344:18)
at boundFn (eval at <anonymous> (app.js:759), <anonymous>:170:14)
at HTMLButtonElement.invoker (eval at <anonymous> (app.js:759), <anonymous>:1743:18)
table没有获取到 $refs为空对象
看官方示例,添加参数<Table …ref=table>