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