vue表格怎么样让是否需要费用为是时才显示费用的值?
<el-table-column
width="180"
:show-overflow-tooltip="true"
label="是否需要费用">
<template slot-scope="scope">
<span v-if="scope.row.isBoothFee == '0'">否</span>
<span v-else-if="scope.row.isBoothFee == '1'">是</span>
</template>
</el-table-column>
<el-table-column
property="boothFee"
width="180"
:show-overflow-tooltip="true"
label="费用">
</el-table-column>
加个三元判断
你这个 需求的话 还真不太好实现 。不过你可以 参考 antd vue的table 来实现 https://www.antdv.com/components/table-cn#components-table-demo-row-selection 。。
antd 是 columns 控制表格 列。那你 element 可以 利用这个思想 然后 v-for循环动态生成el-table-column
跟‘是否需要费用’那一列显示逻辑相同,用v-if,v-else判断
如果你有两行数据,一行是收费一行是不收费。那么你这个表格应该有费用这个列还是没有?