pinia
This commit is contained in:
parent
d83529deb4
commit
aa11c68bad
|
|
@ -16,6 +16,7 @@
|
|||
"element-plus": "^2.9.10",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia-plugin-persistedstate": "^4.3.0",
|
||||
"sortablejs": "^1.15.6",
|
||||
"vue": "^3.5.14",
|
||||
"vue-i18n": "^11.1.5",
|
||||
|
|
|
|||
|
|
@ -1,15 +1,7 @@
|
|||
import {createStore} from 'vuex';
|
||||
import { createPinia } from "pinia"
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
|
||||
const files = import.meta.glob('./model/*.ts', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
})
|
||||
const store = createPinia()
|
||||
store.use(piniaPluginPersistedstate)
|
||||
|
||||
const modules = {}
|
||||
for (const path in files) {
|
||||
modules[path.replace(/(\.\/model\/|\.ts)/g, '')] = files[path]
|
||||
}
|
||||
|
||||
export default createStore({
|
||||
modules
|
||||
});
|
||||
export default store
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
import tools from "@/utils/tools";
|
||||
import config from "@/config";
|
||||
import {defineStore} from "pinia";
|
||||
|
||||
// const globalStore = defineStore('global', {
|
||||
// state: () => {
|
||||
//
|
||||
// }
|
||||
// })
|
||||
|
||||
export default {
|
||||
state: {
|
||||
|
|
@ -13,16 +20,16 @@ export default {
|
|||
layoutTags: true
|
||||
},
|
||||
mutations: {
|
||||
SET_ismobile(state, key){
|
||||
SET_ismobile(state, key) {
|
||||
state.ismobile = key
|
||||
},
|
||||
SET_layout(state, key){
|
||||
SET_layout(state, key) {
|
||||
state.layout = key
|
||||
},
|
||||
TOGGLE_menuIsCollapse(state){
|
||||
TOGGLE_menuIsCollapse(state) {
|
||||
state.menuIsCollapse = !state.menuIsCollapse
|
||||
},
|
||||
TOGGLE_layoutTags(state){
|
||||
TOGGLE_layoutTags(state) {
|
||||
state.layoutTags = !state.layoutTags
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue