| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <template>
- <view class="container">
- <wd-calendar-view v-model="timeValue" custom-class="customClass" @change="handleChange" />
- </view>
- </template>
- <script setup>
- import { ref, onMounted } from 'vue'
- import dayjs from 'dayjs'
- // 当前日期
- const timeValue = ref(0)
- onMounted(() => {
- const bus_date = uni.getStorageSync('bus_date')
- if (bus_date) {
- timeValue.value = dayjs(bus_date).valueOf()
- } else {
- timeValue.value = Date.now()
- }
- })
- // 选中日期的回调
- function handleChange({ value }) {
- // console.log(value)
- const date = dayjs(value).format('YYYY-MM-DD')
- uni.setStorageSync('bus_date', date)
- uni.reLaunch({
- url: `/pages/home/home`
- })
- }
- </script>
- <style lang="scss" scoped>
- .container {
- height: 100vh;
- :deep(.customClass .wd-month-panel__container) {
- height: 100vh !important;
- }
- :deep(.customClass .is-selected .wd-month__day-text) {
- background-color: #ff8205;
- }
- }
- </style>
|