时间控件
This commit is contained in:
@@ -85,16 +85,16 @@ const props = defineProps({
|
||||
},
|
||||
default: {
|
||||
type: String,
|
||||
default: '日',
|
||||
default: '月',
|
||||
},
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits<{
|
||||
(e: 'update-dates', startDate: Date, endDate: Date): void;
|
||||
(e: 'update-dates', startDate: string, endDate: string): void;
|
||||
}>()
|
||||
const timeUnit = ref<string>(props.default) // 默认选择
|
||||
const startDate = ref<Date>(new Date()) // 起始日期
|
||||
const startDate = ref<Date>(new Date(0)) // 起始日期
|
||||
const endDate = ref<Date>(new Date()) // 结束日期
|
||||
const isNextDisabled = ref<boolean>(false) // 控制下一周期按钮的禁用状态
|
||||
const today = ref<Date>(new Date()) // 当前日期
|
||||
@@ -109,7 +109,7 @@ const timeUnits = ref<TimeUnit[]>(
|
||||
// 发出日期变化事件
|
||||
const emitDateChange = () => {
|
||||
emit('update-dates', formatDate(startDate.value), formatDate(endDate.value))
|
||||
//console.log('emitDateChange', startDate.value, endDate.value);
|
||||
console.log('emitDateChange', startDate.value, endDate.value)
|
||||
}
|
||||
|
||||
// 在组件挂载时更新日期范围
|
||||
|
||||
Reference in New Issue
Block a user