bug:因需求,table表格中加入了树形结构,本以为很简单,结果发现了一个问题:
就是点击折叠icon。icon消失了,并且数据也没有展示出来,teble又变成了没有加入树形结构时的状态了
看了很多网上的博客以及教程,并没有解决掉,又看了官网,发现也是没问题的 ,最后就一遍一遍的试。发现是加了ref=“table”,影响了折叠效果
感觉应该是和关键字撞到了一起,所造成的问题,将ref=“table”改个名字就好啦
修改后正确效果:
完整代码:
<el-table
ref="tableRef"
row-key="id"
v-loading="crud.loading"
:header-cell-style="{ color: '#FFF', background: '#333' }"
:cell-style="{ color: '#FFF', background: '#333' }"
:data="tableData"
style="width: 100%"
:default-sort="{ prop: 'barcode', order: 'descending' }"
@selection-change="crud.selectionChangeHandler"
@sort-change="sortChange"
:tree-props="{
children: 'children',
hasChildren: 'hasChildren',
}"
>
<template slot="empty">
<span style="color: #969799">{{ $t("NeoLight.empty") }}</span>
</template>
<el-table-column
type="selection"
width="50"
:reserve-selection="true"
fixed="left"
/>
<el-table-column
prop="barcode"
:sortable="true"
:label="$t('NeoLight.barcodeNo')"
width="180"
/>
<el-table-column
prop="partNumber"
:sortable="true"
:label="$t('NeoLight.stockNo')"
width="150"
/>
<el-table-column
prop="produceDate"
:sortable="true"
:label="$t('NeoLight.produceDate')"
/>
<el-table-column
prop="expireDate"
:sortable="true"
:label="$t('NeoLight.expireDate')"
/>
<!-- 批次 -->
<el-table-column
prop="batch"
:sortable="true"
:label="$t('barcode.batch')"
/>
<!-- 供应商 -->
<el-table-column
prop="provider"
:sortable="true"
:label="$t('storagePos.providerNumber')"
/>
<el-table-column
prop="posName"
:sortable="true"
:label="$t('NeoLight.storageNo')"
/>
<el-table-column
prop="lockName"
:sortable="true"
:label="$t('workOrder.workNo')"
/>
<el-table-column
prop="amount"
:sortable="true"
:label="$t('NeoLight.amount')"
/>
<!-- 首次入库时间 -->
<el-table-column
prop="firstPutInDate"
:sortable="true"
:label="$t('NeoLight.firstPutInDate')"
/>
<el-table-column
prop="putInDate"
:sortable="true"
:label="$t('NeoLight.putInDate')"
/>
<el-table-column
:label="$t('storagePos.operation')"
width="150px"
align="center"
fixed="right"
>
<template slot-scope="scope">
<el-button
icon="el-icon-tickets"
size="mini"
type="primary"
@click="output(scope.$index, scope.row)"
>
{{ $t("NeoLight.workout") }}
</el-button>
</template>
</el-table-column>
</el-table>
tabledata:[],‘数据格式一定要和树形结构要求的格式一致噢~’
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/79204.html