瀏覽代碼

INFO: hydrate store for ssr app

master
valere 5 月之前
父節點
當前提交
51921c9213
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. +1
    -1
      stores/comment.ts

+ 1
- 1
stores/comment.ts 查看文件

@@ -5,7 +5,7 @@ export const useCommentStore = defineStore('comment', {
state: () => ({
comment: useLocalStorage('comment', [])
}),
hydrate(state, initialState) {
hydrate(state, initialState) { // as nuxt is in SSR localstorage is not available so we need to hydrate the app with data first
state.comment = useLocalStorage('comment', [])
},
actions: {


Loading…
取消
儲存