Skip to content

Commit

Permalink
Merge pull request #243 from xuewenG/fix/calendar-column
Browse files Browse the repository at this point in the history
根据可见区域宽度决定日历的列数
  • Loading branch information
xuewenG authored Dec 17, 2024
2 parents 13309ff + a8fa659 commit 0f0b2f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion front/components/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ const attrs = {
'is-dark': { selector: 'html', darkClass: 'dark' },
'first-day-of-week': 2,
}
const columns = document.body.clientWidth < 520 ? 1 : 2
</script>

<template>
<VCalendarDatePicker v-if="date && (typeof date === 'object')" v-model.range="date" :columns="2" v-bind="{ ...attrs, ...$attrs }" />
<VCalendarDatePicker v-if="date && (typeof date === 'object')" v-model.range="date" :columns="columns" v-bind="{ ...attrs, ...$attrs }" />
<VCalendarDatePicker v-else v-model="date" v-bind="{ ...attrs, ...$attrs }" />
</template>

Expand Down

0 comments on commit 0f0b2f8

Please sign in to comment.