<template>
<div class="wrapper">
const dayDif = (date1, date2) => Math.ceil(Math.abs(date1.getTime() -
date2.getTime()) / 86400000)
dayDif(new Date("2021-11-3"), new
Date("2022-2-1")) // 90
</div>
</template>
<script>
export default {
name: "Table",
components: {},
data() {
return {
Name1: "",
Name2: "",
};
},
methods: {
dayDif(date1, date2) {
return Math.ceil(Math.abs(date1.getTime() - date2.getTime()) / 86400000);
},
},
mounted() {
console.log(this.dayDif(new Date("2021-11-3"), new Date("2022-2-1"))); //90
},
};
</script>
<style lang="scss" scoped></style>
【无标题】
最新推荐文章于 2024-09-02 12:54:06 发布