在ant table组件中使用customRender,提示找不到数组,错误处理

在ant table组件中使用customRender,提示找不到数组,错误处理

错误代码图片

在ant table组件中使用customRender,提示找不到数组,错误处理
在ant table组件中使用customRender,提示找不到数组,错误处理
错误原因typearr是vue中的数据,上面数组是在外层script,所以到不到typearr。

解决方法

方法一

把typearr写在< script > 里面
在ant table组件中使用customRender,提示找不到数组,错误处理
在ant table组件中使用customRender,提示找不到数组,错误处理

方法二

使用function函数
function(字段名){ return 数组[字段名] }
在ant table组件中使用customRender,提示找不到数组,错误处理
这种方法数组要声明在data里面
在ant table组件中使用customRender,提示找不到数组,错误处理