forked from Mirrors/elk
refactor: set hydrated value in nuxt plugin
This commit is contained in:
parent
b48a893614
commit
0187763c29
2 changed files with 5 additions and 7 deletions
|
@ -1,8 +1 @@
|
|||
export const isHydrated = ref(false)
|
||||
|
||||
if (!process.server) {
|
||||
const nuxtApp = useNuxtApp()
|
||||
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
|
||||
isHydrated.value = true
|
||||
})
|
||||
}
|
||||
|
|
5
plugins/hydration.client.ts
Normal file
5
plugins/hydration.client.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
|
||||
isHydrated.value = true
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue