0000
This commit is contained in:
@@ -6,14 +6,15 @@ const useTreeDataStore = defineStore("treeDataStore", {
|
||||
return {
|
||||
treeData: [],
|
||||
originTreeData: [],
|
||||
currentNode: undefined
|
||||
currentNode: undefined,
|
||||
isInit: false
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// 不能使用箭头函数,无法绑定this
|
||||
async initTreeData(projectId) {
|
||||
// 获取localStorage的treeData数据
|
||||
if(localStorage.getItem("tree_local_data")){
|
||||
if (localStorage.getItem("tree_local_data")) {
|
||||
this.treeData = JSON.parse(localStorage.getItem("tree_local_data"))
|
||||
}
|
||||
if (this.treeData.length === 0) {
|
||||
@@ -23,8 +24,8 @@ const useTreeDataStore = defineStore("treeDataStore", {
|
||||
}
|
||||
// 将用户关闭页面数据储存于localStorage中 -> 注意用户打开其他项目 -> 务必清除localStorage的tree_local_data数据
|
||||
// 暂定在点击进入工作台时清除!!!
|
||||
window.addEventListener("beforeunload",()=>{
|
||||
localStorage.setItem("tree_local_data",JSON.stringify(this.treeData))
|
||||
window.addEventListener("beforeunload", () => {
|
||||
localStorage.setItem("tree_local_data", JSON.stringify(this.treeData))
|
||||
})
|
||||
},
|
||||
// 用于新增轮次后显示
|
||||
|
||||
Reference in New Issue
Block a user