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

[Vue warn]: Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘$on‘)“

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

項(xiàng)目場(chǎng)景:

vue實(shí)現(xiàn)兄弟進(jìn)程間的通信。


問(wèn)題描述

我想實(shí)現(xiàn)VUE中兄弟組件的通信,除了VueX之外,還可以使用eventBus,這幾個(gè)教程把eventbus講的很詳細(xì)。

(34條消息) Vue 兄弟組件之間的通信_(tái)coffee豆丿的博客-CSDN博客_兄弟組件

大部分教程都是這樣,我看了一個(gè)小時(shí)的教程。但是,我按照他們的代碼去做的時(shí)候,就是會(huì)給我報(bào)標(biāo)題的錯(cuò)。然后我搜索這個(gè)報(bào)錯(cuò),網(wǎng)上的資料也沒(méi)有很多。我記錄一下。


原因分析:

很多博客分析了原因。

1、可能是命名的問(wèn)題:【與我無(wú)關(guān)】

(34條消息) this.$emit方法無(wú)效的原因_來(lái)吧,相約98的博客-CSDN博客_this.$emit不生效
2、可能是因?yàn)樯芷诘膯?wèn)題,然后說(shuō)要把接收方的mounted改成created啥啥的,這個(gè)問(wèn)題確實(shí)很關(guān)鍵,但是沒(méi)解決我的?!緹┧懒?,哈哈,毀滅吧,哈哈】

(34條消息) Vue中bus報(bào)錯(cuò)TypeError: Cannot read property ‘$emit‘ of undefined_盞茶作酒的博客-CSDN博客_cannot read property '$emit' of undefined

3、最后,也就是終極原因,考慮到VUE的事件監(jiān)聽(tīng)機(jī)制。監(jiān)聽(tīng)必須要在觸發(fā)之前,也就是說(shuō)$on的執(zhí)行必須要在$emit之前?!韭?tīng)我說(shuō)謝謝你】

(34條消息) vue bus.$emit觸發(fā)第一次$on監(jiān)聽(tīng)不到_microcosm1994的博客-CSDN博客_vue bus觸發(fā)第一次,后續(xù)不觸發(fā)

555555,我就為這么一個(gè)小問(wèn)題,我解決了一個(gè)小時(shí)5555。


解決方案:

解決方案就是:反正我看不懂這話,懶得看了。

用法:將回調(diào)延遲到下次 DOM 更新循環(huán)之后執(zhí)行。在修改數(shù)據(jù)之后立即使用它,然后等待 DOM 更新。它跟全局方法 Vue.nextTick 一樣,不同的是回調(diào)的 this 自動(dòng)綁定到調(diào)用它的實(shí)例上。

你只需要把emit函數(shù)的那一句變一變就好了。

this.$nextTick(function () {
        // DOM 現(xiàn)在更新了
        eventBus.$emit('msg',route)
      })

對(duì),沒(méi)錯(cuò),就是這么簡(jiǎn)單。

對(duì)我自己想說(shuō)的

我喜歡這樣的自己。高冷冷在它的博客里說(shuō),任何事情都可以變的很簡(jiǎn)單,我們需要有耐心,然后為這件事情做足充分的準(zhǔn)備。

努力coding,做一個(gè)對(duì)程序代碼有耐心和好奇心的銀。555文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-408096.html

到了這里,關(guān)于[Vue warn]: Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘$on‘)“的文章就介紹完了。如果您還想了解更多內(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報(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 callback for watcher “l(fā)ss“: “TypeError: Cannot read properties of undefined

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

    在練習(xí)本地資源存儲(chǔ)的時(shí)候,需要將數(shù)據(jù)存放在瀏覽器內(nèi),存放的時(shí)候需要使用到監(jiān)視屬性,實(shí)現(xiàn)每次更新都重新存儲(chǔ)。 于是在操作過(guò)程中遇到了這個(gè)類型的問(wèn)題?,F(xiàn)已解決 [Vue warn]: Error in callback for watcher \\\"lss\\\": \\\"TypeError: Cannot read properties of undefined (reading \\\'apply\\\')\\\" 大概的意思是

    2024年02月07日
    瀏覽(32)
  • [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 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)
  • Error in onChooseAvatar hook: “TypeError: Cannot read property ‘a(chǎn)pply‘ of undefined“

    Error in onChooseAvatar hook: “TypeError: Cannot read property ‘a(chǎn)pply‘ of undefined“

    unapp編譯微信小程序后運(yùn)行報(bào)錯(cuò)[Vue warn]: Error in onChooseAvatar hook: \\\"TypeError: Cannot read property \\\'apply\\\' of undefined\\\" 由于微信小程序官方調(diào)整了用戶昵稱獲取方法,這里特別吐槽下微信官方就微信昵稱頭像接口方法差不多每年都得改一次,無(wú)力吐槽每次給的最佳實(shí)踐每年都在被推翻,畢

    2024年02月09日
    瀏覽(25)
  • Error in mounted hook: TypeError: Cannot read properties of undefined (reading isHiddenDay ) found

    Error in mounted hook: TypeError: Cannot read properties of undefined (reading isHiddenDay ) found

    Error in mounted hook: TypeError: Cannot read properties of undefined (reading isHiddenDay ) found 無(wú)法讀取未定義的屬性‘isHiddenDay’. 在vue中使用fullcalendar在mounted鉤子中渲染報(bào)錯(cuò) 我在一個(gè)小demo中實(shí)現(xiàn)還是好好的,并且用的依賴都是6.x版本的,但是當(dāng)我合并到正式項(xiàng)目中時(shí)確一直無(wú)法渲染出來(lái)。并

    2024年02月04日
    瀏覽(25)
  • 【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)
  • 解決Vue報(bào)錯(cuò)Error in callback for immediate watcher “height“: “TypeError: Cannot read properties of

    解決Vue報(bào)錯(cuò)Error in callback for immediate watcher “height“: “TypeError: Cannot read properties of

    最近在項(xiàng)目中遇到了一個(gè)問(wèn)題,控制臺(tái)報(bào)錯(cuò)Error in callback for immediate watcher \\\"height\\\": \\\"TypeError: Cannot read properties of undefined (reading \\\'style\\\')\\\",找了好久,不知道哪里的錯(cuò)誤,最后終于解決了,于是記錄一下。 控制臺(tái)報(bào)錯(cuò),如下所示 這個(gè)錯(cuò)誤報(bào)得莫名其妙,既沒(méi)告訴你具體位置,也沒(méi)

    2024年02月11日
    瀏覽(26)
  • 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)紅包