可能原因
在调取接口获取返回值时,由于各种原因(参数错误、返回格式不规范等),导致接收返回时数据类型与初始值不同。
data () { return { list: [] //原本是个数组对象 } }, methods: { getList() {
let params = {} apiRequest(params).then(res => { this.list = res.data //此时返回的为null this.total = res.data.length }) }, }
解决办法
在处理返回值时加上判断
if(res.data) { this.list = res.data this.total = res.data.length }
- 控制台 quot properties TypeError reading控制台quot properties typeerror properties typeerror undefined reading properties typeerror reading cannot properties typeerror express reading properties typeerror content reading quot properties typeerror undefined properties typeerror undefined uncaught addeventlistener typeerror uncaught property typeerror non-mysql undefined property typeerror undefined property cannot