Skip to content

Commit

Permalink
perf(store): 🚀 性能优化 (#12)
Browse files Browse the repository at this point in the history
* perf(store): 🚀 背景图片地址 http 转 https

* perf(store): 🚀 修改插件引入方式
  • Loading branch information
waset authored Oct 22, 2022
1 parent 3e5a959 commit 629271d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 3 additions & 1 deletion composables/useIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export const useIndexStore = definePiniaStore({
},

wallpaperImg(): string {
return `url(${this.list[Math.floor(Math.random() * this.list.length)].img_1024_768})`
let url = this.list[Math.floor(Math.random() * this.list.length)].img_1024_768
url = url.replace(/^http:\/\//i, 'https://')
return `url(${url})`
},

searchWebisteListHeight() {
Expand Down
2 changes: 1 addition & 1 deletion composables/useSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ export const useSetStore = definePiniaStore({
*
* @see https://github.com/prazdevs/pinia-plugin-persistedstate
*/
persist: false,
persist: true,
})
13 changes: 5 additions & 8 deletions plugins/pinia.client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
/**
* 在客户端引入 pinia 持续化存储插件
* 客户端引入 pinia 持续化存储插件
*/
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = ({ $pinia }) => {
$pinia.use(piniaPluginPersistedstate)
}

export default pinia
export default defineNuxtPlugin(({ $pinia }) => {
$pinia?.use(piniaPluginPersistedstate)
})

1 comment on commit 629271d

@vercel
Copy link

@vercel vercel bot commented on 629271d Oct 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

navigation – ./

navigation-wecases.vercel.app
navigation-sigma.vercel.app
navigation-git-main-wecases.vercel.app

Please sign in to comment.