valaxy-theme-hairy 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-hairy",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "packageManager": "pnpm@8.15.8",
5
5
  "author": {
6
6
  "email": "wwu710632@gmail.com",
@@ -1,7 +1,8 @@
1
1
  import { defineStore } from 'pinia'
2
2
  import { ref } from 'vue'
3
+ import { withGlobalPinia } from '../../utils'
3
4
 
4
- export const useGlobalStore = defineStore('global', () => {
5
+ const _useGlobalStore = defineStore('global', () => {
5
6
  const headerRef = ref<HTMLDivElement>()
6
7
  const showDrawer = ref(false)
7
8
 
@@ -10,3 +11,5 @@ export const useGlobalStore = defineStore('global', () => {
10
11
  showDrawer,
11
12
  }
12
13
  })
14
+
15
+ export const useGlobalStore = withGlobalPinia(_useGlobalStore)
package/utils/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './size'
2
2
  export * from './util'
3
+ export * from './pinia'
package/utils/pinia.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { createPinia } from 'pinia'
2
+
3
+ const pinia = createPinia()
4
+
5
+ export function withGlobalPinia<T>(useStore: T) {
6
+ const helper = (_pinia = pinia, hot: any) => (useStore as any)(pinia, hot)
7
+ return helper as unknown as T
8
+ }
9
+
10
+ export default pinia