diff --git a/src/packages/__VUE/calendar/demo.vue b/src/packages/__VUE/calendar/demo.vue index 2b1f028074..6ef79d1d15 100644 --- a/src/packages/__VUE/calendar/demo.vue +++ b/src/packages/__VUE/calendar/demo.vue @@ -185,6 +185,29 @@ +
+ + + + + +

{{ translate('title3') }}

conjunction: '至', custom_btn: '自定义按钮', timeText: '自定义时间文案', + custom_footer: '自定义底部', + custom_footer_text1: '偶数的日期不能选择', + custom_footer_text2: '奇数的日期可以选择', goDate: '去某个月', seven: '最近七天', @@ -269,6 +295,9 @@ const initTranslate = () => conjunction: '-', custom_btn: 'Custom Button', timeText: 'Custom Date Text', + custom_footer: 'Custom Footer', + custom_footer_text1: 'Even dates cannot be selected', + custom_footer_text2: 'Odd dates can be selected', goDate: 'Go Date', seven: 'Last Seven Days', @@ -297,6 +326,7 @@ export default defineComponent({ date7: [] as string[], date8: '', date9: [] as string[], + date10: '2023-09-03', isVisible1: false, isVisible2: false, isVisible3: false, @@ -305,7 +335,9 @@ export default defineComponent({ isVisible6: false, isVisible7: false, isVisible8: false, - isVisible9: false + isVisible9: false, + isVisible10: false, + disabled10: false }); const openSwitch = (param: string) => { (state as any)[`${param}`] = true; @@ -359,6 +391,10 @@ export default defineComponent({ let { weekDate } = param; state.date9 = [weekDate[0].date[3], weekDate[1].date[3]]; }; + const setSelectalue10 = (param: any) => { + state.disabled10 = param[2] % 2 === 0; + }; + const clickBtn = () => { let date = [Utils.date2Str(new Date()), Utils.getDay(6)]; state.date5 = date; @@ -382,6 +418,10 @@ export default defineComponent({ const renderDate = (date: { date: Day }) => { return +date.date.day <= 9 ? '0' + date.date.day : date.date.day; }; + const clickBtn10 = (dateInfo: any) => { + state.date10 = dateInfo.date[3]; + state.isVisible10 = false; + }; return { ...toRefs(state), openSwitch, @@ -396,13 +436,15 @@ export default defineComponent({ setChooseValue6, setChooseValue8, setChooseValue9, + setSelectalue10, clickBtn, clickBtn1, goDate, calendarRef, select, translate, - renderDate + renderDate, + clickBtn10 }; } }); diff --git a/src/packages/__VUE/calendar/doc.en-US.md b/src/packages/__VUE/calendar/doc.en-US.md index d32fe3169f..363d935e23 100644 --- a/src/packages/__VUE/calendar/doc.en-US.md +++ b/src/packages/__VUE/calendar/doc.en-US.md @@ -632,6 +632,71 @@ When set to week selection, the start and end dates of the week will be determin ::: +### Custom Footer + +:::demo + +```html + + + +``` + +::: + ### Tiled Display :::demo @@ -716,6 +781,7 @@ When set to week selection, the start and end dates of the week will be determin | day | Date information | | top-info | Date top information | | bottom-info | Date bottom information | +| footer-info | Custom calendar Footer, replace confirm btn | ### Methods diff --git a/src/packages/__VUE/calendar/doc.md b/src/packages/__VUE/calendar/doc.md index 5db2d7403a..9079eae12b 100644 --- a/src/packages/__VUE/calendar/doc.md +++ b/src/packages/__VUE/calendar/doc.md @@ -583,6 +583,71 @@ app.use(Calendar); ::: +### 自定义底部区域 + +:::demo + +```html + + + +``` + +::: + ### 自定义周起始日 :::demo @@ -726,6 +791,7 @@ app.use(Calendar); | day | 日期信息 | | top-info | 日期顶部信息 | | bottom-info | 日期底部信息 | +| footer-info | 日历自定义底部,替代confirm按钮 | ### Methods diff --git a/src/packages/__VUE/calendar/index.taro.vue b/src/packages/__VUE/calendar/index.taro.vue index 76468bccd8..a6a1a15e3c 100644 --- a/src/packages/__VUE/calendar/index.taro.vue +++ b/src/packages/__VUE/calendar/index.taro.vue @@ -46,6 +46,9 @@ + { return slots['bottom-info']; }); + const footerInfo = computed(() => { + return slots['footer-info']; + }); // element refs const calendarRef = ref(null); const scrollToDate = (date: string) => { @@ -228,7 +234,8 @@ export default create({ showTopBtn, topInfo, dayInfo, - bottomInfo + bottomInfo, + footerInfo }; } }); diff --git a/src/packages/__VUE/calendar/index.vue b/src/packages/__VUE/calendar/index.vue index 152e6e4305..cd4925805f 100644 --- a/src/packages/__VUE/calendar/index.vue +++ b/src/packages/__VUE/calendar/index.vue @@ -45,6 +45,9 @@ + { return slots['bottom-info']; }); + const footerInfo = computed(() => { + return slots['footer-info']; + }); // element refs const calendarRef = ref(null); const scrollToDate = (date: string) => { @@ -228,7 +234,8 @@ export default create({ showTopBtn, topInfo, dayInfo, - bottomInfo + bottomInfo, + footerInfo }; } }); diff --git a/src/packages/__VUE/calendaritem/index.taro.vue b/src/packages/__VUE/calendaritem/index.taro.vue index 9199758e27..de86673114 100644 --- a/src/packages/__VUE/calendaritem/index.taro.vue +++ b/src/packages/__VUE/calendaritem/index.taro.vue @@ -75,7 +75,9 @@ - {{ confirmText || translate('confirm') }} + + {{ confirmText || translate('confirm') }} + diff --git a/src/packages/__VUE/calendaritem/index.vue b/src/packages/__VUE/calendaritem/index.vue index 955c9ff862..163b57cc76 100644 --- a/src/packages/__VUE/calendaritem/index.vue +++ b/src/packages/__VUE/calendaritem/index.vue @@ -68,7 +68,9 @@ - {{ confirmText || translate('confirm') }} + + {{ confirmText || translate('confirm') }} +