Skip to content

Commit

Permalink
docs: fix datepicker week firstdayofweek usage demo
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Sep 24, 2024
1 parent 6f19fe0 commit a9bd0ad
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
19 changes: 17 additions & 2 deletions src/date-picker/_example-composition/week.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<template>
<t-space direction="vertical">
<t-date-picker mode="week" clearable allow-input />
<t-date-range-picker mode="week" clearable allow-input />
<t-date-picker mode="week" clearable allow-input :first-day-of-week="weekStart" />

<t-date-range-picker mode="week" clearable allow-input :first-day-of-week="weekStart" />
</t-space>
</template>
<script setup>
// 如果配合 firstDayOfWeek API 使用,请使用 dayjs 同步修改 weekStart,否则部分日期选择会用异常
import { ref } from 'vue';
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
weekStart: 2,
});
const weekStart = ref(2);
</script>
24 changes: 22 additions & 2 deletions src/date-picker/_example/week.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
<template>
<t-space direction="vertical">
<t-date-picker mode="week" clearable allow-input />
<t-date-range-picker mode="week" clearable allow-input />
<t-date-picker mode="week" clearable allow-input :first-day-of-week="weekStart" />

<t-date-range-picker mode="week" clearable allow-input :first-day-of-week="weekStart" />
</t-space>
</template>
<script>
// 如果配合 firstDayOfWeek API 使用,请使用 dayjs 同步修改 weekStart,否则部分日期选择会用异常
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
weekStart: 2,
});
export default {
data() {
return {
weekStart: 2,
};
},
};
</script>

0 comments on commit a9bd0ad

Please sign in to comment.