提交 f9b6cf49 编写于 作者: laizhilong's avatar laizhilong

修改下拉树初始化回调逻辑

上级 c4fd2a75
...@@ -79,10 +79,10 @@ ...@@ -79,10 +79,10 @@
} }
tempData.push(tempItem); tempData.push(tempItem);
}); });
// 给树赋值 // 给树赋值
this.options = tempData; this.options = tempData;
this.$nextTick(() => { // 下拉树
// 树
let tree: any = this.$refs.selectTree; let tree: any = this.$refs.selectTree;
// 第一个叶子节点 // 第一个叶子节点
let firstNode:any = {}; let firstNode:any = {};
...@@ -91,21 +91,23 @@ ...@@ -91,21 +91,23 @@
}else { }else {
firstNode = tempData[0]; firstNode = tempData[0];
} }
// 设置树当前选中值
tree.setCurrentKey(firstNode[0].id);
// 从local中拿刷新前选中值 // 从local中拿刷新前选中值
if (localStorage.getItem('localdata')) { if (localStorage.getItem('localdata')) {
const localdata:any = JSON.parse(localStorage.getItem('localdata') as string); const localdata:any = JSON.parse(localStorage.getItem('localdata') as string);
this.valueId = localdata.dstappid; this.valueId = localdata.dstappid;
this.valueTitle = localdata.title; this.valueTitle = localdata.title;
this.defaultExpandedKey.push(localdata.dstappid); this.defaultExpandedKey.push(localdata.dstappid);
// 设置下拉树选中值
tree.setCurrentKey(localdata.dstappid);
}else { }else {
// 设置下拉框默认值 // 设置下拉框默认值
this.valueId = firstNode[0].id; this.valueId = firstNode[0].id;
this.valueTitle = firstNode[0].systemId + "-" + firstNode[0].label; this.valueTitle = firstNode[0].systemId + "-" + firstNode[0].label;
this.defaultExpandedKey.push(firstNode[0].id); this.defaultExpandedKey.push(firstNode[0].id);
// 设置下拉树选中值
tree.setCurrentKey(firstNode[0].id);
} }
});
} }
} else { } else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册