vuepress-reco / vuepress-theme-reco

🎨 This is the repo for vuepress-theme-reco 2.
https://vuepress-theme-reco.recoluan.com
MIT License
575 stars 183 forks source link

report an error “localStorage is not defined” when build version:"vuepress-theme-reco": "2.0.0-beta.41" #144

Closed VaCameos closed 1 year ago

VaCameos commented 1 year ago

Bug report

I use a custom components, and i import a TS file in VUE file . In the TS file , I use the API 'localStorage'. My code works fine locally , but it throw a error when i build it. My code is as follows

What is actually happening?

error report image

my code image image

And I found another suspected bug , but I'm not sure it is .So let me just say that by the way . When I first went to the home page, there seemed to be something wrong with the pagination . as follow first image

Switch from another page to the home page image

Other relevant information

VaCameos commented 1 year ago

第一个问题是因为在挂载前使用了localstorage ,在mounted钩子里使用则不报错 , 第二个问题尚未解决

recoluan commented 1 year ago

试一下 vuepress@2.0.0-beta.60 和 vuepress-theme-reco@2.0.0-beta.44