3030 <i @click =" showDesktop" >
3131 <svg-icon name =" desktop" style =" width : 2.2rem ;height : 2.2rem " />
3232 </i >
33- <div class =" time flex" >
33+ <div class =" time flex" @click = " toggleCalendar " >
3434 <time >{{time}}</time >
3535 <span >{{date}}</span >
3636 </div >
3737 </div >
3838
39- <left-menu :show =" showLeft" @focusout =" leftFocusout" />
39+ <left-menu ref = " leftmenu " :show =" showLeft" @focusout =" leftFocusout" />
4040 <right-menu :show =" showRight" @focusout =" rightFocusout" />
41+ <the-calendar ref =" calendar" :show =" showCalendar" @focusout =" calendarFocusout" />
4142 <span class =" bg" ></span >
4243 </section >
4344</template >
@@ -47,17 +48,19 @@ import {defineComponent} from 'vue';
4748import AppIcon from " ./appIcon.vue" ;
4849import leftMenu from " ./leftMenu.vue" ;
4950import rightMenu from " ./rightMenu.vue" ;
51+ import TheCalendar from " ./calendar.vue" ;
5052import dayjs , {Dayjs } from " dayjs" ;
5153import {typeApp } from " ../../utils/apps" ;
5254import mixin from " ../../utils/mixin" ;
5355
5456export default defineComponent ({
5557 name: " index" ,
56- components: {AppIcon , leftMenu , rightMenu },
58+ components: {AppIcon , leftMenu , rightMenu , TheCalendar },
5759 data (){
5860 return {
5961 showLeft: false ,
6062 showRight: ' ' ,
63+ showCalendar: false ,
6164 oldShowRight: ' ' ,
6265 animation: false ,
6366
@@ -89,7 +92,9 @@ export default defineComponent({
8992 },
9093 methods: {
9194 toggleLeftMenu (){
92- if (this .animation ) return
95+ const actived = this .$refs .leftmenu .$el .classList .contains (' active' );
96+ if (this .animation && actived ) return ;
97+ this .animation = false ;
9398 ! this .showLeft && (this .showLeft = ! this .showLeft );
9499 },
95100 leftFocusout (){
@@ -117,6 +122,17 @@ export default defineComponent({
117122 this .showDesktopLis .push (app .name )
118123 }
119124 })
125+ },
126+ toggleCalendar (){
127+ const actived = this .$refs .calendar .$el .classList .contains (' active' );
128+ if (this .animation && actived ) return ;
129+ this .showCalendar = ! actived ;
130+ this .animation = false ;
131+ },
132+ calendarFocusout (){
133+ this .showCalendar = false ;
134+ this .animation = true ;
135+ setTimeout (()=> this .animation = false , 200 )
120136 }
121137 }
122138})
0 commit comments