• element ui el-tree组件 首项选中效果


    默认首项选中效果

     dom层,

    指定key(业务id),ref="tree",highlight-current-row,:highlight-current="true"属性加上

    el-tree(
        :data="typeArr",
        ref="tree",
        :highlight-current="true",
        highlight-current-row,
        node-key="equipTypeId",
        @node-click="handleNodeClick",
        default-expand-all,
        :expand-on-click-node="false"
    )

    script层

    setCurrentKey,设置首项的业务id 
    watch: {
        "$store.state.devMng.devType": function (n) {
               this.typeArr = n;
           this.$nextTick(() => {
             this.$refs.tree.setCurrentKey(n[0].equipTypeId);
           });
        },
    },

    这样就好了

    希望可以帮到你,我是金陵彭于晏,我们下篇博客见!!!

  • 相关阅读:
    iOS数据持久化的方式
    Runtime
    <02>
    <01>
    <02>
    UIActivityIndicatorView
    <01>数据存储
    UI<10>
    UI<09>
    UI<08>
  • 原文地址:https://www.cnblogs.com/lq2333/p/14982476.html
Copyright © 2020-2023  润新知