feature: pinia添加持久化存储
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { createPinia } from "pinia";
|
||||
import piniaPersist from 'pinia-plugin-persist'
|
||||
|
||||
// 1. 实例化pinia
|
||||
const pinia = createPinia()
|
||||
pinia.use(piniaPersist)
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
|
||||
@@ -53,5 +53,8 @@ export const useCartStore = defineStore('cart', {
|
||||
this.checkStatus = checkoutStatus.FALSE
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// persist: {
|
||||
// enabled: true
|
||||
// }
|
||||
})
|
||||
|
||||
@@ -16,5 +16,8 @@ export const useProductStore = defineStore('product', {
|
||||
productItem.inventory--
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// persist: {
|
||||
// enabled: true
|
||||
// }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user