el-table 树形数据 当展开的时候没有数据 展开的icon图标就隐藏了
怎么修改 不论有没有数据 图标都不隐藏


el-table 树形数据 当展开的时候没有数据 展开的icon图标就隐藏了
怎么修改 不论有没有数据 图标都不隐藏


用 scope 在里面判断
<el-table-column label="名称">
<template slot-scope="scope">
<span v-if="scope.row.children && scope.row.children.length > 0">
<i class="el-icon-caret-right" v-if="!scope.row.expanded" @click="handleExpand(scope.row)"></i>
<i class="el-icon-caret-down" v-else @click="handleExpand(scope.row)"></i>
</span>
<span v-else>
<i class="el-icon-caret-right" @click="handleExpand(scope.row)"></i>
</span>
{{ scope.row.name }}
</template>
</el-table-column>
然后,在methods中实现handleExpand方法,根据row的expanded属性来切换展开状态