更新记录
1.0.0(2025-10-18) 下载此版本
无
平台兼容性
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
引入:
import hbCalendar from "./components/hb-calendar/hbCalendar.vue"
export default {
components: {
hbCalendar
}
}
使用:
<template>
<view class="content">
<button @click="showCalendar = true">选择日期 {{ selectedDate ? formatDate(selectedDate) : '点击选择' }}
</button>
<hb-calendar
:visible="showCalendar"
@update:visible="showCalendar = $event"
:show-footer="true"
:default-date="selectedDate"
@confirm="onConfirm"
@select="onChange">
</hb-calendar>
</view>
</template>
onChange(date) {
console.log('当前选中', date);
},
onConfirm(date) {
console.log('确认选择', date);
},
formatDate(date) {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${year}年${month}月${day}日`;
},