问题描述①:

在一个页面中表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>

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐