获取其他列的数据标签:vue,price,record,design,table,customRender,price2,priceType From: https://blog.51cto.com/u_12528551/5900334
{
title: '价格(元)',
align: "center",
dataIndex: '',
scopedSlots: { customRender: 'price' },
// customRender: (text, record) => {
// if (record.priceType == '1') {
// return record.price;
// } else if (record.priceType == '2') {
// return record.price + " - " + record.price2;
// } else if (record.priceType == '3') {
// ...
// }
// }
},
若要添加样式
{
title: '价格(元)',
align: "center",
dataIndex: '',
scopedSlots: { customRender: 'price' }
},
在a-table中
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="tableList"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="price" slot-scope="text, record">
<span v-if="record.priceType == '1'">
<span>{{record.price}}</span>
</span>
<span v-if="record.priceType == '2'">
{{record.price}} - {{record.price2}}
</span>
<span v-if="record.priceType == '3'">
<span style="text-decoration:line-through">{{record.price}}</span>(原价) {{record.price2}}(现价)
</span>
</span>
效果图: