Error in callback for watcher "echartData": "TypeError: Cannot read properties of undefined (reading 'length')"
时间: 2024-01-10 13:20:29 浏览: 90
grape-middleware-logger:记录Grape应用程序的中间件
以下是关于"Error in callback for watcher 'echartData': 'TypeError: Cannot read properties of undefined (reading 'length')'"的解释和演示:
1. 对象属性检查
```javascript
var b = {name:1}
console.log(b.hasOwnProperty('name')) // 输出:true
```
2. Promise执行顺序
```javascript
const p1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve(1)
throw new Error('p1失败信息')
}, 2000)
})
const p2 = p1
.then((val) => {
console.log(val, 'p2成功返回的')
return val + 1
})
.catch((err) => {
console.log(err, 'p2失败返回的')
return err
})
Promise.all([p2, Promise.reject(3)])
.then((val2) => {
console.log(val2, 'all成功返回的')
})
.catch((err2) => {
console.log(err2, 'all失败返回的')
})
```
阅读全文