nuxt localStorage is not defined

简介: nuxt localStorage is not defined

背景

在nuxt.js的vue create生命周期中用到localStorege(window也是)报了localStorage is not defined的错,

解决办法

解决:在mounted生命周期中用localStorage

目录
相关文章
|
负载均衡 安全 中间件
Express——结合multer上传图片、EJS
Express——结合multer上传图片、EJS
170 0
|
4月前
|
开发框架 小程序
uniApp——Eslint报错'uni' is not defined
uniApp——Eslint报错'uni' is not defined
204 0
vuepress打包报错 localStorage is not defined
vuepress打包报错 localStorage is not defined
199 2
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
|
7月前
|
JavaScript
vue ssr 报错 ReferenceError: MouseEvent is not defined / window is not defined 等等
vue ssr 报错 ReferenceError: MouseEvent is not defined / window is not defined 等等
201 0
|
前端开发 定位技术 API
react BMap is not defined 或者 BMapGL is not defined
react BMap is not defined 或者 BMapGL is not defined
464 0
|
JavaScript
vite无法使用require,require is not defined
vite无法使用require,require is not defined
553 0
|
JavaScript
【Vue】【杂碎】v-on:change = “methods()“和v-on:change = “methods“的区别
【Vue】【杂碎】v-on:change = “methods()“和v-on:change = “methods“的区别
137 0
|
JavaScript
Vue3——使用inject和provide对页面进行刷新
使用inject和provide对页面进行刷新
1001 0
|
JavaScript 前端开发 API
前端工作总结126-vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because proper
前端工作总结126-vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because proper
609 0
前端工作总结126-vue项目报错[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because proper