Răsfoiți Sursa

优化工作台日历

qinzhipeng_v@didiglobal.com 4 ani în urmă
părinte
comite
f578ccefbf
1 a modificat fișierele cu 7 adăugiri și 14 ștergeri
  1. 7 14
      src/views/workbench/person/components/myFullCalendar.vue

+ 7 - 14
src/views/workbench/person/components/myFullCalendar.vue

@@ -4,8 +4,8 @@
       <article class="calender-top">
         <div class="calender-top-control">
           <el-button-group>
-            <el-button icon="el-icon-arrow-left" size="small" @click="callCalendarApi('prev')" />
-            <el-button icon="el-icon-arrow-right" size="small" @click="callCalendarApi('next')" />
+            <el-button icon="el-icon-arrow-left" size="small" @click="methods = 0, callCalendarApi('prev')" />
+            <el-button icon="el-icon-arrow-right" size="small" @click="methods = 0, callCalendarApi('next')" />
           </el-button-group>
           <el-button-group v-if="weekMonYear">
             <el-button type="primary" size="small" @click="callCalendarApi('changeView','dayGridMonth')">月</el-button>
@@ -13,7 +13,7 @@
             <el-button type="primary" size="small" @click="callCalendarApi('changeView','timeGridDay')">日</el-button>
           </el-button-group>
           <el-button-group style="margin-left: 20px">
-            <el-button type="primary" size="small" :class="todayClassName" @click="callCalendarApi('today')">今天</el-button>
+            <el-button type="primary" size="small" :class="todayClassName" @click=" methods++, callCalendarApi('today')">今天</el-button>
           </el-button-group>
         </div>
         <div class="calender-top-title">{{ calendarTitle }}</div>
@@ -105,7 +105,7 @@ export default {
   },
   data() {
     return {
-      methods: 0,
+      methods: 1,
       dateList: [],
       activeName: '1',
       today: new Date(),
@@ -185,7 +185,6 @@ export default {
       this.$emit('expand', true)
     },
     callCalendarApi(methods, viewName) {
-      methods === 'today' ? this.methods++ : ''
       const calendarApi = this.$refs.fullCalendar.getApi()
       if (methods) {
         if (viewName) {
@@ -195,16 +194,10 @@ export default {
         }
       }
       this.$nextTick(() => {
-        setTimeout(() => {
-          this.setIcon()
-        }, 2000)
+        setTimeout(() => { this.setIcon() }, 2000)
         this.$emit('change', calendarApi.view)
-        if (methods === 'today') {
-          this.methods >= 2 ? console.log(this.methods, '才能不') : this.setDate()
-        } else {
-          this.setDate()
-          this.methods = 0
-        }
+        if (methods === 'today' && this.methods > 1) return false
+        this.setDate()
       })
       this.calendarTitle = calendarApi.view.title
       if (calendarApi.view.activeStart.getTime() < this.today.getTime() && this.today.getTime() < calendarApi.view.activeEnd.getTime()) {