ve3 v-calendar如何打开日历到特定的过去一个月



使用V-Calendar,我如何将日历呈现为过去的特定月份?而不是当前月份。

我正在尝试以下内容:

Html:

<v-calendar :attributes="attributes"...></v-calendar>

JS:

<script setup>
const attributes = ref([
{
id: 'some-random-id',
dates: new Date(2018,3,1)
}
])
</script>

然而它仍然打开到当前月份,而不是我想从2018年开始的月份。我希望避免在onMounted中做.move('2018-03-01'),因为如果我这样做,那么UI会"闪烁",它最初加载到当前月份,然后过渡到2018月份。谢谢。

你想使用的道具是from-page

描述:位于第0行和第0列的第一个日历窗格的页(月、年)。使用.sync修饰符进行双向绑定。

<template>
<v-calendar :from-page="date" />
</template>
<script>
import { ref } from 'vue';
export default {
setup() {
const date = ref({});
return {
date
};
},
mounted() {
this.date = { month: 3, year: 2018 };
}
};
</script>

最新更新