工作169:vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties
vue項(xiàng)目中報(bào)錯(cuò):
[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
如下:
報(bào)錯(cuò)原因:
項(xiàng)目中使用的是Element UI消息提示Message:import { Message } from 'element-ui';
請(qǐng)求響應(yīng)攔截器中err處理的代碼錯(cuò)誤:
Message.error(response.data.data|| "出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試");//寫(xiě)法錯(cuò)誤,因?yàn)镸essage.error()或Message()接收類型string/VNode,而現(xiàn)在response.data.data是個(gè)數(shù)組,所以報(bào)錯(cuò)。
?
解決方法:
改成如下兩種寫(xiě)法都可以了
Message.error({message: response.data.data || "出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試"})或Message({type:'error',message: response.data.data || "出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試"})總結(jié):這種錯(cuò)誤一般都是因?yàn)閭鞯膮?shù)跟方法接受參數(shù)類型不符引起的。
總結(jié)
以上是生活随笔為你收集整理的工作169:vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: multisim中pwl_Multisi
- 下一篇: 工作74:vue带参数跳转其他页面