dataIndex 文本
{
title: "title",
dataIndex: "title",
},
customRender 插槽:选择性文本
{
title: "sex",
dataIndex: "sex",
customRender: (text, row, index) => {
switch (text) {
case '1':
return 'male';
case '0':
return 'female';
default:
return 'unknown';
}
}
},
scopedSlots 传递
{
title: "operation",
dataIndex: 'operation',
width: "120px",
fixed: "right",
scopedSlots: { customRender: 'operation' }
}
传递单个column,定义模块 slot接受的值operation
<template slot="operation" slot-scope="record">
<a class="edit" @click="() => do(record)">
点击传递单行column
</a>
</template>
处理时间
vue过滤器,可以用于过滤或者格式化,用{{|}}插值操作
第一个参数,默认参数为被过滤的对象
{
title: "处理时间",
dataIndex: "time",
scopedSlots: { customRender: 'time' }
},
<template slot="time" slot-scope="record">
<div v-show="record.time!= 0">
<div >{{ record.time | dealTime }}</div>
</div>
</template>
filters:{
dealTime(time){return time;}
}