Prechádzať zdrojové kódy

机构树选中状态问题

jiawuxian 2 rokov pred
rodič
commit
b87499071b
1 zmenil súbory, kde vykonal 11 pridanie a 2 odobranie
  1. 11 2
      src/components/orgTree/index.vue

+ 11 - 2
src/components/orgTree/index.vue

@@ -20,6 +20,7 @@
         :filter-node-method="filterNode"
         ref="tree"
         node-key="id"
+        class="el-tree-ex"
         :default-expanded-keys="defaultKeys"
         :default-checked-keys="defaultKeys"
         @node-click="handleNodeClick"
@@ -85,6 +86,9 @@ export default {
         this.defaultKeys.push(response.data[0].id);
         this.$emit('defaultKey',response.data[0].id);
         this.defaultKey = response.data[0].id;
+        setTimeout(() => {
+          this.$refs.tree.setCurrentKey(response.data[0].id)
+        }, 100);        
       });
     },
     // 筛选节点
@@ -100,6 +104,11 @@ export default {
 }
 </script>
 
-<style scoped>
-
+<style lang='scss' scoped>
+  .el-tree-ex {
+    overflow: auto;
+    ::v-deep .is-current > .el-tree-node__content {
+      background-color: #d1e0f1 !important;
+    }   
+  }
 </style>