vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties start
vue项目中报错:[Vue warn]: Property "visible" must be accessed with "$data.visible" because properties starting with "$" or "_" are not proxied in the Vue instance to prevent conflicts with Vue internalsSee
·
vue项目中报错:
[Vue warn]: Property "visible" must be accessed with "$data.visible" because properties starting with "$" or "_" are not proxied in the Vue instance to prevent conflicts with Vue internalsSee: https://vuejs.org/v2/api/#data
如下:
报错原因:
项目中使用的是Element UI消息提示Message:import { Message } from 'element-ui';
请求响应拦截器中err处理的代码错误:
Message.error(response.data.data|| "出现错误,请稍后再试");//写法错误,
因为Message.error()或Message()接收类型string/VNode,而现在response.data.data是个数组,所以报错。
解决方法:
改成如下两种写法都可以了
Message.error({
message: response.data.data || "出现错误,请稍后再试"
})
或
Message({
type:'error',
message: response.data.data || "出现错误,请稍后再试"
})
总结:这种错误一般都是因为传的参数跟方法接受参数类型不符引起的。
更多推荐
所有评论(0)