日历优化

This commit is contained in:
XaoLi717 2024-12-10 14:24:21 +08:00
parent 6cd778c5d3
commit ac3d70f44f

View File

@ -153,6 +153,7 @@ const formDataCaln = ref({
// const data = await CalendarApi.createCalendar(dda) // const data = await CalendarApi.createCalendar(dda)
// console.log(data) // console.log(data)
// } // }
// //
const isCurrentMonth = (date:any,index:number) => { const isCurrentMonth = (date:any,index:number) => {
const SelectDate = date.date; const SelectDate = date.date;
@ -252,6 +253,7 @@ const submitForm = async (date:any)=> {
// //
updatedHoliday.visible = false; updatedHoliday.visible = false;
} }
const closePopover = async (date:any)=> { const closePopover = async (date:any)=> {
// //
await getDate(date); await getDate(date);
@ -260,6 +262,7 @@ const closePopover = async (date:any)=> {
// //
updatedHoliday.visible = false; updatedHoliday.visible = false;
} }
// //
function formatDate2(dat: number|Date) { function formatDate2(dat: number|Date) {
const date = new Date(dat) const date = new Date(dat)
@ -268,6 +271,7 @@ function formatDate2(dat: number|Date) {
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
} }
// //
const selectDate = (val:number) => { const selectDate = (val:number) => {
if (!val){ if (!val){
@ -275,15 +279,19 @@ const selectDate = (val:number) => {
} }
currentYear.value += val currentYear.value += val
} }
//toYear Button change data go to year //toYear Button change data go to year
const toYear = () => { const toYear = () => {
currentYear.value = new Date().getFullYear() currentYear.value = new Date().getFullYear()
} }
// //
onMounted( async ()=> { onMounted( async ()=> {
await getListDate() await getListDate()
}) })
</script> </script>
<!-- 样式很重要 --> <!-- 样式很重要 -->
<style lang="scss"> <style lang="scss">
.close-But { .close-But {