VUE中使用TS 提示Type ‘xxx[]‘ is not assignable to type ‘never[]‘错误处理

报错分析:
TS默认初始化空数组为 never[] 类型,跟你赋值的数据类型不匹配

解决方案:
初始化值的时候在后面加 as any 就可以了

data: []
改为
data: [] as any
posted @ 2023-03-31 10:52  清和时光  阅读(1682)  评论(0编辑  收藏  举报