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

Cannot read properties of undefined (reading ‘key‘)

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

如標(biāo)題所示錯(cuò)誤,直譯是key為undefined。本次是因?yàn)槭褂昧薳lement-ui中的el-table組件所以并不是key為undefined,而是后臺(tái)返回的key有重復(fù)。

當(dāng)key重復(fù)就會(huì)出現(xiàn)頁(yè)面卡死的現(xiàn)象,渲染就會(huì)失敗。

key在使用時(shí)我們要注意:

1.在渲染時(shí)該識(shí)別為不同時(shí),識(shí)別為相同

2.在渲染時(shí)該識(shí)別為相同,卻識(shí)別為了不同

解決問(wèn)題如下:

? getRowKey(row) {
? /** 檢查row.id是否有重復(fù)的緩存對(duì)象 */
? if (!this.checkRepeatObj) {
? ? this.checkRepeatObj = {}
? }
? if (row) {
? ? if (row.id) {
? ? ? if (this.checkRepeatObj[row.id]) {
? ? ? ? if (!row._secondId) {
? ? ? ? ? row._secondId = Math.random() + ''
? ? ? ? }
? ? ? ? /** 方便根據(jù)key重用元素 */
? ? ? ? return row._secondId
? ? ? } else {
? ? ? ? this.checkRepeatObj[row.id] = 1
? ? ? ? return row.id
? ? ? }
? ? }
? ? console.log('row.id為空')
? ? if (!row._secondId) {
? ? ? row._secondId = Math.random() + ''
? ? }
? ? return row._secondId
? } else {
? ? console.log('row為空')
? ? return Math.random() + ''
? }
}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-436513.html

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

本文來(lái)自互聯(lián)網(wǎng)用戶(hù)投稿,該文觀點(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)文章

  • 解決Cannot read properties of undefined (reading ‘resetFields‘)

    解決Cannot read properties of undefined (reading ‘resetFields‘)

    第一天做項(xiàng)目中遇到了這一個(gè)問(wèn)題關(guān)于resetField重置校驗(yàn)報(bào)錯(cuò)的問(wèn)題, ? 然后去網(wǎng)上查找問(wèn)題的原因,但是找到問(wèn)題的原因是: mouted加載table數(shù)據(jù)以后,隱藏的 Dialog 并沒(méi)有編譯渲染進(jìn) dom 里面。所以當(dāng)通過(guò)點(diǎn)擊事件,Dialog 彈出的時(shí)候,$refs 并沒(méi)有獲取到 dom 元素導(dǎo)致 ‘reset

    2023年04月23日
    瀏覽(23)
  • TypeError: Cannot read properties of undefined (reading ‘replace‘)

    錯(cuò)誤一:TypeError: Cannot read properties of undefined (reading \\\'replace\\\') 錯(cuò)誤二:[Vue warn]: inject() can only be used inside setup() or functional conponents. 解釋?zhuān)寒?dāng)我們使用內(nèi)置 use開(kāi)頭的鉤子函數(shù)時(shí),不能進(jìn)行嵌套去拿實(shí)例。如: 解決:必須在 setup函數(shù) 第一層調(diào)用。

    2024年02月11日
    瀏覽(21)
  • TypeError: Cannot read properties of undefined (reading ‘map‘)

    TypeError: Cannot read properties of undefined (reading ‘map‘)

    控制臺(tái)報(bào)錯(cuò) TypeError: Cannot read properties of undefined (reading \\\'map\\\') 我的錯(cuò)誤原因: 第一次頁(yè)面渲染的時(shí)候,map的對(duì)象是undefined或null, 解決方法: 在前面加個(gè)要進(jìn)行判斷,當(dāng)有值時(shí)再去遍歷

    2024年02月07日
    瀏覽(28)
  • [已解決]Cannot read properties of undefined (reading ‘install‘)

    唉,對(duì)于計(jì)算機(jī)的bug是真的很害怕。但是這個(gè)錯(cuò)誤,我發(fā)現(xiàn)解決起來(lái)還是蠻簡(jiǎn)單的。 參考這篇博客: (2條消息) 錯(cuò)誤“Cannot read properties of undefined (reading ‘install‘) at Vue.use” 的解決方案_cannot read properties of undefined (reading \\\'inst_FunSober的博客-CSDN博客 原因主要就是我們?cè)谙螺d

    2024年02月13日
    瀏覽(25)
  • Uncaught TypeError: Cannot read properties of undefined (reading ‘remove‘)

    在Vue 3中,你可能會(huì)遇到“Uncaught TypeError: Cannot read properties of undefined (reading \\\'remove\\\')”這樣的錯(cuò)誤,這通常是因?yàn)樵诮M件銷(xiāo)毀時(shí),嘗試訪問(wèn)已經(jīng)被銷(xiāo)毀的元素或事件監(jiān)聽(tīng)器。 為了解決這個(gè)問(wèn)題,你可以在組件銷(xiāo)毀之前,確保移除所有的事件監(jiān)聽(tīng)器和其他可能導(dǎo)致問(wèn)題的操作。

    2024年01月20日
    瀏覽(43)
  • Uncaught TypeError: Cannot read properties of undefined (reading ‘use‘)

    報(bào)錯(cuò):Uncaught TypeError: Cannot read properties of undefined (reading ‘use’) 原因:Vue-router版本問(wèn)題,在vue-router3可在router/index.js中安裝router插件,但4不支持 解決: 1、在router/index.js中,導(dǎo)出{createRouter, createWebHistory}兩個(gè)函數(shù) 使用createRouter來(lái)創(chuàng)建路由對(duì)象 使用createWebHistory函數(shù)賦值給histor

    2024年02月13日
    瀏覽(43)
  • TypeError: Cannot read properties of undefined (reading ‘NAME‘)報(bào)錯(cuò)解決

    問(wèn)題描述:前端一個(gè)el-table表格,一個(gè)醫(yī)院查詢(xún)到的科室從后端返回時(shí)總是顯示不出來(lái),response里面是有數(shù)據(jù)的,這個(gè)表格別的醫(yī)院都能顯示出科室,就那個(gè)醫(yī)院顯示不出。報(bào)錯(cuò):TypeError: Cannot read properties of undefined (reading \\\'NAME\\\') ?查找問(wèn)題所在,發(fā)現(xiàn)el-table里面有一個(gè):formatte

    2024年02月01日
    瀏覽(31)
  • Vue報(bào)錯(cuò) Cannot read properties of undefined (reading ‘websiteDomains‘) 解決辦法

    Vue報(bào)錯(cuò) Cannot read properties of undefined (reading ‘websiteDomains‘) 解決辦法

    瀏覽器控制臺(tái)如下報(bào)錯(cuò): Unchecked runtime.lastError: The message port closed before a response was received. Uncaught (in promise) TypeError: Cannot read properties of undefined (reading \\\'websiteDomains\\\') ? ? at xl-content.js:1:100558 此問(wèn)題困擾了很久,偶然看到一篇博文,說(shuō)是迅雷擴(kuò)展問(wèn)題 要想解決這個(gè)bug最有效的方

    2024年04月24日
    瀏覽(31)
  • vue項(xiàng)目中Cannot read properties of undefined (reading ‘getters‘)問(wèn)題

    vue項(xiàng)目中Cannot read properties of undefined (reading ‘getters‘)問(wèn)題

    在vuex的index.js中引入分割的模塊 import {toastStatus} from \\\"./toastStatus\\\"; 會(huì)報(bào)如下錯(cuò)誤 ? toastStatus的index.js中是用export default整體導(dǎo)出的,但是在引用的時(shí)候用了按需導(dǎo)入的格式,所以報(bào)錯(cuò) 將花括號(hào)刪除即可 import toastStatus from \\\"./toastStatus\\\";

    2024年02月12日
    瀏覽(15)
  • 【bug】TypeError: Cannot read properties of undefined (reading ‘_wrapper‘)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包