54321
This commit is contained in:
@@ -6,15 +6,9 @@ import useTabBarStore from "./modules/tab-bar"
|
||||
import useFormStore from "./modules/form"
|
||||
import useKeepAliveStore from "./modules/keepAlive"
|
||||
import useTagStore from "./modules/tag"
|
||||
import useTreeDataStore from "./project/treeData"
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
export {
|
||||
useUserStore,
|
||||
useAppStore,
|
||||
useTabBarStore,
|
||||
useFormStore,
|
||||
useKeepAliveStore,
|
||||
useTagStore,
|
||||
}
|
||||
export { useUserStore, useAppStore, useTabBarStore, useFormStore, useKeepAliveStore, useTagStore,useTreeDataStore }
|
||||
export default pinia
|
||||
|
||||
27
cdTMP/src/store/project/treeData.js
Normal file
27
cdTMP/src/store/project/treeData.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { defineStore } from "pinia"
|
||||
import projectApi from "@/api/project/project"
|
||||
|
||||
const useTreeDataStore = defineStore("treeDataStore", {
|
||||
state: () => {
|
||||
return {
|
||||
treeData: [],
|
||||
originTreeData: [],
|
||||
currentNode: undefined
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// 不能使用箭头函数,无法绑定this
|
||||
async initTreeData(projectId) {
|
||||
if (this.treeData.length === 0) {
|
||||
const roundData = await projectApi.getRoundInfo(projectId)
|
||||
this.treeData = roundData
|
||||
this.originTreeData = roundData
|
||||
}
|
||||
},
|
||||
setCurrentNode(nodeKey) {
|
||||
this.currentNode = nodeKey
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default useTreeDataStore
|
||||
Reference in New Issue
Block a user