zizhong.wang преди 3 години
родител
ревизия
6e7de47daa
променени са 1 файла, в които са добавени 17 реда и са изтрити 2 реда
  1. 17 2
      components/lx-calendar/lx-calendar.vue

+ 17 - 2
components/lx-calendar/lx-calendar.vue

@@ -2,9 +2,9 @@
 <template>
 	<view class="date">
 		<view class="head">
-			<view class="icon" @click="switch_month_week('prev',true)"><text class="iconfont icon-fanhui" /></view>
+			<view class="icon" @click="switch_month_week('prev',true)"><text class="iconfont icon-fanhui" :class="[currentMonth == nowMonth ? 'disabled' : '']" /></view>
 			<view class="title">{{nowYear+'年'+nowMonth+'月'}}</view>
-			<view class="icon" @click="switch_month_week('next',true)"><text class="iconfont next icon-fanhui" /></view>
+			<view class="icon" @click="switch_month_week('next',true)"><text class="iconfont next icon-fanhui" :class="[currentMonth + 1 == nowMonth ? 'disabled' : '']" /></view>
 		</view>
 		<view class="date_dl" >
 			<view class="dd" v-for="(item,index) in week" :key="index">{{item}}</view>
@@ -77,6 +77,7 @@ export default {
 			next_date:'',
 			nowYear:'',
 			nowMonth:'',
+			currentMonth:'',
 			nowDay:'',
 			retract:true,
 			to_week_index:0,
@@ -131,6 +132,9 @@ export default {
 				this.get_date();
 			}
 			
+			let date = new Date();
+			this.currentMonth = date.getMonth() + 1;
+			
 			this.doc_list_update();
 			this.update_month();
 			this.open();
@@ -366,6 +370,7 @@ export default {
 			this.nowDay = now_arr[2];
 			
 			
+			
 			this.set_to_day_all(item_index);
 			
 			this.nowTime = this.date_parse(`${item.date}`);
@@ -415,6 +420,12 @@ export default {
 			return Date.parse(str.replace(/-(\d)(?!\d)/g, '-0$1'));
 		},
 		switch_month_week(type = 'next',update_week = false){
+			if (this.currentMonth == this.nowMonth && type=="prev"){
+				return;
+			}
+			if (this.currentMonth + 1 == this.nowMonth && type=="next"){
+				return;
+			}
 			if(this.retract){
 				if(type == 'prev'){
 					this.get_date(this.nowTime - 86400 * 7 * 1000);
@@ -592,6 +603,10 @@ export default {
 			transform: rotate(180deg); display: block;
 		}
 	}
+	
+}
+.disabled{
+		color: @color_disabled;
 }
 .retract{
 	display: flex; justify-content: center; align-items: center; height: 80rpx;;