表格中的倒计时,如何结束时间endTime减去现在时间,得出还剩几天几时几分钟几秒
<template>
<a-table :columns="columns" :data-source="dataSource">
<template #bodyCell="{ column, text }">
<template v-if="column.dataIndex === 'name'">
<a>{{ text }}</a>
</template>
<template v-if="column.dataIndex === 'time'">
<a>{{ text }}</a>
</template>
</template>
</a-table>
</template>
<script>
import { defineComponent } from 'vue';
const dataSource = [
{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号',
time:'2023-4-1 00:00:00'
},
{
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号',
time:'2023-5-1 00:00:00'
},
]
const columns = [
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '住址',
dataIndex: 'address',
key: 'address',
},
{
title:'倒计时',
dataIndex:'time',
key:'time'
}
]
export default defineComponent({
setup() {
return {
dataSource,
columns,
};
},
});
</script>