vue element ui tree全部展开

vue yekong

vue项目开发要求element ui tree全部展开,于是查询记录了一下。
使用default-expand-all进行控制

<el-tree
node-key="id"
:data="organizationTree"
:props="defaultProps"
:default-expand-all="true"
:default-expanded-keys="expandedKeys"
:default-checked-keys="checkedKeys"
icon-class=" "
@node-click="handleNodeClick">
 <span class="custom-tree-node" slot-scope="{node, data}">
  <span :class="{'text-green': treeLeaf(data)}">
    <i
      :class="['fa', {'icon0' : treeLeaf(data)==1,'icon1': treeLeaf(data)==2,'icon2': treeLeaf(data)==3}]"
      class="mr10"></i>
    <span class="ellipsis" style="user-select:none;" :title="node.label">{{ node.label }}</span>
  </span>
</span>
</el-tree>
喜欢