1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Ant Design Vue 日期时间格式化

Ant Design Vue 日期时间格式化

时间:2022-01-10 13:34:07

相关推荐

Ant Design Vue 日期时间格式化

引入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' },},],

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。