• Q:elementUI中tree组件动态展开


    1,在组件中设置展开收缩开关  default-expand-all="isExpand"

     2,展开收起触发按钮

    <div class="tree-foot clearfix">
      <el-button class="fr" size="mini" plain type="primary" icon="el-icon-caret-top" @click="CloseFun">关闭</el-button>
       <el-button class="fr" size="mini" plain type="primary" icon="el-icon-caret-bottom" @click="ExpandFun">展开</el-button>
    </div>
    

    3,这里采用ref来获取DOM。

    // 展开收起
      ExpandFun(){
        console.log(this.$refs.navtree[0].store._getAllNodes().length)
        // let type = Object.prototype.toString.call(this.$refs.navtree)
        this.isExpand = true;
        this.DynamicScaling()
      }
      CloseFun(){
        this.isExpand = false;
        this.DynamicScaling()
      }
      DynamicScaling(){
          for(let j=0; j<this.$refs.navtree.store._getAllNodes().length; j++){
            this.$refs.navtree.store._getAllNodes()[j].expanded= this.isExpand;
          }
      }
    本想把日子过成诗,时而简单,时而精致,不料日子却过成了一首歌,时而不靠谱,时而不着调
  • 相关阅读:
    hdu2328 Corporate Identity
    hdu1238 Substrings
    hdu4300 Clairewd’s message
    hdu3336 Count the string
    hdu2597 Simpsons’ Hidden Talents
    poj3080 Blue Jeans
    poj2752 Seek the Name, Seek the Fame
    poj2406 Power Strings
    hust1010 The Minimum Length
    hdu1358 Period
  • 原文地址:https://www.cnblogs.com/chuanq/p/11525938.html
Copyright © 2020-2023  润新知