我在我的 vue 项目中使用 v-data-picker 。我想自定义这个组件,我想知道如何只允许显示星期一。另外几天应该被禁用。
代码:
<template>
<v-row justify="center">
<v-date-picker
v-model="date"
:allowed-dates="allowedDates"
class="mt-4"
min="2016-06-15"
max="2018-03-20"
></v-date-picker>
</v-row>
</template>
Run Code Online (Sandbox Code Playgroud)
<script>
export default {
data: () => ({
date: '2018-03-02',
}),
methods: {
allowedDates: val => parseInt(val.split('-')[2], 10) % 2 === 0,
},
}
</script>
Run Code Online (Sandbox Code Playgroud)