TypeError: Cannot read property 'length' of undefined
[Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined"
- 某個(gè)數(shù)組沒(méi)值導(dǎo)致的問(wèn)題
- 寫了
this.$emit('getDate', val)
提交的方法的同時(shí)额获,又定義了this.$refs['formName'].getDate()
方法導(dǎo)致的
數(shù)組賦值字段為null
Error in getter for watcher "parsedValue": "TypeError: Cannot read property 'length' of null"
- 接口返回字段給數(shù)組設(shè)置默認(rèn)值時(shí)矩桂,注意返回字段為null, 而不是空字符串扼脐,會(huì)報(bào)以上錯(cuò)誤。
- 解決方案:給賦值數(shù)組定義默認(rèn)值
let arr = [a1||'', a2||'']