引入moment
import moment from 'moment'
Ant Design Vue
<a-tableref="table"rowKey="id":columns="columns":dataSource="dataSource":pagination="ipagination":loading="loading" @change="handleTableChange"><template slot="operation" slot-scope="text, record"><a href="#" class="table_edit" @click="editDecive(record.id)">编辑</a><a-popconfirm title="是否删除?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)"><a href="#" class="table_delete table_gap">删除</a></a-popconfirm></template><template slot="time" slot-scope="time">{{ time | filterTime(time) }}</template></a-table>
利用 vue的filters
filters: {filterTime(time) {return moment(time).format('YYYY-MM-DD')},},
columns:[]
columns: [{title: '序号',dataIndex: 'id',key: 'id',},{title: '项目名称',dataIndex: 'projectName',key: 'projectName',},{title: '简介',dataIndex: 'remark',key: 'remark',},{title: '开始时间',dataIndex: 'startTime',key: 'startTime',scopedSlots: { customRender: 'time' },},{title: '结束时间',dataIndex: 'endTime',key: 'endTime',scopedSlots: { customRender: 'time' },},{title: '相机数量',dataIndex: 'num',key: 'num',},{title: '操作',scopedSlots: { customRender: 'operation' },},],