<template>
<div>
<p>Today is {{ today }}</p>
</div>
</template>
<script>
export default {
data() {
return {
today: ''
}
},
mounted() {
this.today = this.getCurrentDate();
},
methods: {
getCurrentDate() {
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
let day = now.getDate();
return year + "-" + month + "-" + day;
}
}
}
</script>
vue获取当前年月日
最新推荐文章于 2024-05-16 13:30:42 发布