天天看點

vue 報錯 TypeError: Cannot read properties of undefined (reading ‘toLowerCase‘)

vue nuxt.js 報錯TypeError: Cannot read properties of undefined (reading ‘toLowerCase’)和TypeError: Cannot read properties of undefined (reading ‘_transitionClasses’)

問題描述: 一個标簽頁切換元件,watch監聽他active是哪個,然後顯示對應資料時,切換不了,且控制台報錯TypeError: Cannot read properties of undefined (reading ‘toLowerCase’)和TypeError: Cannot read properties of undefined (reading ‘_transitionClasses’)

原因: 可能是在created中擷取localStorage了

解決辦法: 在mounted中去擷取localStorage就沒有報錯了

vue 報錯 TypeError: Cannot read properties of undefined (reading ‘toLowerCase‘)

繼續閱讀