【报错】unhandled error during execution of watcher callback

简介: JavaScript错误`unhandled error during execution of watcher callback`在Echarts图表渲染时出现,通常是因数据未获取到就尝试渲染导致。解决方法是在渲染前添加非空判断,如`if(value){开始渲染数据}`或`if(value !== undefined){开始渲染数据}`,确保数据加载完成后再执行渲染。

@[toc]

报错

unhandled error during execution of watcher callback

分析

在使用Echarts图标绘制数据时,报错:unhandled error during execution of watcher callback,提示的原因是因为当年数据还未拿到时就开始渲染Echarts图表,导致图表展现不出来报错

解决

在数据渲染之前先做一下非空判断
例如:

if(value){
    开始渲染数据
}

if(value !== undefined){
    开始渲染数据
}
相关文章
npm 启动报错 解决 events.js:174 throw er; // Unhandled 'error' event 的报错问题
npm 启动报错 解决 events.js:174 throw er; // Unhandled 'error' event 的报错问题
npm 启动报错 解决 events.js:174 throw er; // Unhandled 'error' event 的报错问题
|
6月前
|
JavaScript 开发者
vue解决报错Unable to preventDefault inside passive event listener invocation.
vue解决报错Unable to preventDefault inside passive event listener invocation.
628 0
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
6月前
|
安全
Error:Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'
Error:Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'
55 0
|
6月前
【报错】unhandled error during execution of watcher callback
【报错】unhandled error during execution of watcher callback
168 0
throw new MongooseError(‘Mongoose.prototype.connect() no longer accepts a callback‘);
throw new MongooseError(‘Mongoose.prototype.connect() no longer accepts a callback‘);
147 1
|
JavaScript
[Vue warn] Error in callback for immediate watcher “data“ “TypeError Cannot read property ‘reduce
[Vue warn] Error in callback for immediate watcher “data“ “TypeError Cannot read property ‘reduce
378 0
|
Java Spring
Redisson BUG: Failed to submit a listener notification task. Event loop shut down?
Redisson BUG: Failed to submit a listener notification task. Event loop shut down?
1380 0
|
JavaScript
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
284 0
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“