问题描述①:
在一个页面中表A展示如下

切换到表B,内容、操作栏按钮错位

解决问题①:
解决方式一:在表A的el-table里面,增加一个关键字key,唯一标识下即可
<el-table :data="tableData" border style="width: 100%" height="600" key="index1">

解决方式二:在第一个表,表A的操作栏,操作栏处的template标签里面,新增一个v-if条件,控制按钮隐藏显示。
问题描述②:
设置效果如下,是否为系统客户栏下标签,可根据每一行数据改变不同样式,适用于二元值

解决问题②:
<el-table :data="tableData" border style="width: 100%" height="600">
<el-table-column prop="customerId" label="是否为系统客户" width="140">
<template slot-scope="scope">
<el-tag :type="scope.row.customerId != null ? 'success' : 'primary'" disable-transitions>{{ scope.row.customerId != null ? "✔" : "×" }}</el-tag>
</template>
</el-table-column>
.....
</el-table>
在所需要二元判断tag的el-table-column行,下面嵌入
<template slot-scope="scope"> </template>
然后运用二元表达式,分别控制tag类型和显示值样式即可
<el-tag :type="scope.row.customerId != null ? 'success' : 'primary'" disable-transitions>{{ scope.row.customerId != null ? "✔" : "×" }}</el-tag>
文章讲述了在Vue框架的ElementUI中遇到的两个问题:表A与表B切换时操作栏错位的解决方法,以及如何根据数据动态设置系统客户标签样式。作者提供了两种方式来处理这些问题。

1127

被折叠的 条评论
为什么被折叠?



