国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[Vue warn]: Error in callback for watcher “l(fā)ss“: “TypeError: Cannot read properties of undefined

這篇具有很好參考價(jià)值的文章主要介紹了[Vue warn]: Error in callback for watcher “l(fā)ss“: “TypeError: Cannot read properties of undefined。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

問(wèn)題描述

在練習(xí)本地資源存儲(chǔ)的時(shí)候,需要將數(shù)據(jù)存放在瀏覽器內(nèi),存放的時(shí)候需要使用到監(jiān)視屬性,實(shí)現(xiàn)每次更新都重新存儲(chǔ)。
于是在操作過(guò)程中遇到了這個(gè)類(lèi)型的問(wèn)題?,F(xiàn)已解決

cannot read properties of undefined (reading 'apply'),網(wǎng)頁(yè)前端高級(jí)編程從入門(mén)到精通,vue.js,javascript,前端

[Vue warn]: Error in callback for watcher "lss": "TypeError: Cannot read properties of undefined (reading 'apply')"大概的意思是,在監(jiān)視lss屬性的時(shí)候,回調(diào)函數(shù)不能為undefined。這是一個(gè)比較粗心的問(wèn)題,每一個(gè)監(jiān)視屬性都需要寫(xiě)一下handler(新值){}函數(shù)。函數(shù)名不能寫(xiě)錯(cuò),我遇到這個(gè)問(wèn)題就是因?yàn)楹瘮?shù)名拼寫(xiě)錯(cuò)誤了,監(jiān)視屬性回調(diào)handler的時(shí)候找不到,報(bào)錯(cuò)。

問(wèn)題解決方法

原代碼

watch:{
  lss:{
    deep:true,
    // 這里的拼寫(xiě)不要寫(xiě)錯(cuò)了,否則會(huì)報(bào)錯(cuò)
    Handler(newvalue){
      console.log(this.lss)
      localStorage.setItem("lss",JSON.stringify(newvalue))
    }
  }
}

更改后的代碼

watch:{
  lss:{
    deep:true,
    // 這里的拼寫(xiě)不要寫(xiě)錯(cuò)了,否則會(huì)報(bào)錯(cuò)
    handler(newvalue){
      console.log(this.lss)
      localStorage.setItem("lss",JSON.stringify(newvalue))
    }
  }
}

不要過(guò)于依賴(lài)編譯器,遇到這個(gè)錯(cuò)誤的原因就是將handler寫(xiě)成了Handler,全部歸功于vscode插件,一步步把我?guī)?,最后?jīng)過(guò)多處打印,多處調(diào)試才想起來(lái)檢查一下函數(shù)名的事,希望大家不要學(xué)我粗心又費(fèi)時(shí)間。


cannot read properties of undefined (reading 'apply'),網(wǎng)頁(yè)前端高級(jí)編程從入門(mén)到精通,vue.js,javascript,前端文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-727492.html


到了這里,關(guān)于[Vue warn]: Error in callback for watcher “l(fā)ss“: “TypeError: Cannot read properties of undefined的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 解決Vue Uniapp中[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined 報(bào)錯(cuò)

    解決Vue Uniapp中[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined 報(bào)錯(cuò)

    ?在頁(yè)面元素進(jìn)行v-for循環(huán)遍歷時(shí)通過(guò) a.b.c 方式找到后臺(tái)中的數(shù)據(jù),解析完成后,頁(yè)面正常渲染,但是控制臺(tái)報(bào)錯(cuò). 這是因?yàn)?js是解釋型語(yǔ)言,讀取一行,加載一樣 所以頁(yè)面的加載,比發(fā)送請(qǐng)求要快,要早 請(qǐng)求數(shù)據(jù)雖然放在了created中,但是請(qǐng)求數(shù)據(jù)是異步的,需要時(shí)間。 也

    2024年02月11日
    瀏覽(29)
  • Vue報(bào)錯(cuò)解決[Vue warn]: Error in render: “TypeError: Cannot read property ‘state‘ of undefined“

    Vue報(bào)錯(cuò)解決[Vue warn]: Error in render: “TypeError: Cannot read property ‘state‘ of undefined“

    Vue2項(xiàng)目中報(bào)錯(cuò): [Vue warn]: Error in render: “TypeError: Cannot read property ‘state’ of undefined” [Vue warn]: Error in mounted hook: “TypeError: Cannot read property ‘dispatch’ of undefined” 這個(gè)錯(cuò)誤提示通常出現(xiàn)在 Vue 組件中,它嘗試讀取 Vuex store 的 state 對(duì)象,但是該對(duì)象沒(méi)有被定義。這可能是由以

    2024年02月10日
    瀏覽(48)
  • 解決:[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined (reading ‘matched‘)“

    解決:[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined (reading ‘matched‘)“

    在vue項(xiàng)目中使用路由報(bào)以下錯(cuò)誤: [Vue warn]: Error in render: \\\"TypeError: Cannot read properties of undefined (reading \\\'matched\\\')\\\" ,如圖?? 這個(gè)錯(cuò)誤表示,App組件在渲染過(guò)程中嘗試訪問(wèn)一個(gè)未定義的屬性或方法,例如訪問(wèn)一個(gè)空對(duì)象的屬性或調(diào)用一個(gè)未定義的函數(shù)。 出錯(cuò)的代碼嘗試訪問(wèn)一個(gè)叫

    2024年02月12日
    瀏覽(31)
  • [Vue warn]: Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘$on‘)“

    vue實(shí)現(xiàn) 兄弟進(jìn)程 間的通信。 我想實(shí)現(xiàn)VUE中兄弟組件的通信,除了VueX之外,還可以使用eventBus,這幾個(gè)教程把eventbus講的很詳細(xì)。 (34條消息) Vue 兄弟組件之間的通信_(tái)coffee豆丿的博客-CSDN博客_兄弟組件 大部分教程都是這樣,我看了一個(gè)小時(shí)的教程。但是,我按照他們的代碼去

    2023年04月09日
    瀏覽(28)
  • [Vue warn]: Error in render: “TypeError: Cannot read property ‘ xxx ‘ of undefined“報(bào)錯(cuò)原因和解決

    [Vue warn]: Error in render: “TypeError: Cannot read property ‘ xxx ‘ of undefined“報(bào)錯(cuò)原因和解決

    遇到問(wèn)題: 能夠正常渲染出界面,但控制臺(tái)仍然報(bào)出“Error in render: \\\"TypeError: Cannot read property ‘0’ of undefined”錯(cuò)誤 原因: vuex中state管理加載的數(shù)據(jù),異步調(diào)用顯示,然后vue渲染機(jī)制 異步數(shù)據(jù)先顯示初始數(shù)據(jù),再顯示帶數(shù)據(jù)的數(shù)據(jù),所以上來(lái)加載時(shí)候還是一個(gè)空對(duì)象,當(dāng)渲

    2024年02月11日
    瀏覽(33)
  • vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in nextTick: “TypeError: Cannot read properties of und

    vue使用vue-element-admin報(bào)錯(cuò): 原因是: 其中 ayout=\\\"prev, pager, next\\\" 的pager拼寫(xiě)錯(cuò)了

    2024年02月16日
    瀏覽(93)
  • [Vue warn]: Error in v-on handler: “TypeError: Cannot read properties of undefined (reading ‘$refs‘)

    [Vue warn]: Error in v-on handler: “TypeError: Cannot read properties of undefined (reading ‘$refs‘)

    報(bào)錯(cuò): [Vue warn]: Error in v-on handler: \\\"TypeError: Cannot read properties of undefined (reading \\\'$refs\\\')\\\" ? 背景: 1.在做vue項(xiàng)目時(shí),在功能彈框中,想實(shí)現(xiàn)新增內(nèi)容。 ? ? ? ? ? ? ?2. 報(bào)錯(cuò)原因是要觸發(fā)menuCheckall組件后,才可以提交,因?yàn)椴挥|發(fā)menuCheckall的時(shí)候dom未加載, 沒(méi)有編譯渲染進(jìn)dom里

    2024年01月18日
    瀏覽(57)
  • 【Vue】- 報(bào)錯(cuò) Error in render: “TypeError: Cannot read properties of undefined (reading ‘nickname‘)“

    【Vue】- 報(bào)錯(cuò) Error in render: “TypeError: Cannot read properties of undefined (reading ‘nickname‘)“

    在created()鉤子函數(shù)請(qǐng)求接口并報(bào)錯(cuò)數(shù)據(jù),渲染在dom元素是可以正常渲染,但是在開(kāi)發(fā)者工具中就會(huì)報(bào)錯(cuò) Error in render: \\\"TypeError: Cannot read properties of undefined (reading \\\'nickname\\\')\\\" ?意思是 在created調(diào)用封裝請(qǐng)求接口的函數(shù) ,獲取到的數(shù)據(jù)再給保存起來(lái)并渲染到dom元素,不過(guò)數(shù)據(jù)渲染之

    2023年04月21日
    瀏覽(36)
  • uniapp [Vue warn]: Error in onLoad hook: “TypeError: Attempting to change the setter of an unconfigu

    用uniapp開(kāi)發(fā)微信小程序時(shí)候發(fā)現(xiàn)報(bào)這個(gè)錯(cuò)誤,記錄下我是如何解決的! uniapp [Vue warn]: Error in onLoad hook: \\\"TypeError: Attempting to change the setter of an unconfigurable property.\\\" 由于在Object.defineproperty方法中,控制屬性不可以被刪除, unconfigurable 狀態(tài)。 我們來(lái)看下 Object.defineproperty方法的具體

    2024年02月13日
    瀏覽(16)
  • vue報(bào)錯(cuò)解決:Error in v-on handler (Promiseasync) “TypeError Cannot read properties ofundefined

    vue報(bào)錯(cuò)解決:Error in v-on handler (Promiseasync) “TypeError Cannot read properties ofundefined

    報(bào)錯(cuò)信息:[Vue warn]: Error in v-on handler (Promise/async): \\\"TypeError: Cannot read properties of undefined (reading \\\'code \\\')” axios可以獲取數(shù)據(jù),控制臺(tái)輸出為undefined 報(bào)錯(cuò)代碼: 錯(cuò)誤原因:在①或者②的axios請(qǐng)求時(shí),請(qǐng)求結(jié)果被catch捕獲,所以axios可以獲取到數(shù)據(jù),但在catch中的res此時(shí)是未賦值的,

    2024年02月07日
    瀏覽(37)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包