帮助了 AmazingCounters.com 位小伙伴

uniapp 日期操作

 

 

 

 

 

 

 

 

 

<view class="promotionDetail-bot-title">
					<view class="promotionDetail-bot-title-left">提成明细</view>
					 <view class="promotionDetail-bot-title-right">
						<view class="pDbtp-item">{{year||nowYear}}年</view>
						<image class="pDbtp-icon" mode="widthFix" src="/static/index_72.png"></image>
						<view class="pDbtp-item">{{month||nowMonth}}月</view>
						<image class="pDbtp-icon" mode="widthFix" src="/static/index_72.png"></image>
						<picker class="pDbtp-picker" :end='end' mode="date" fields="month" v-model="date" @change="dateChange">
							<view class="pDbtp-picker-pad"></view>
						</picker>
					</view>
				</view>

















data() {
			return {
				
				year: '',
				month: '',
				nowYear: '',
				nowMonth: '',
			}
		},

onLoad(){
			let now = new Date();
			this.nowYear = now.getFullYear();
			this.nowMonth = now.getMonth() + 1;
			this.end = `${this.nowYear}-${this.nowMonth}`;
		},





// 选择时间
			dateChange(e) {
				console.log(e)
				let date = e.detail.value;
				this.year = date.match(/\d{4}/)[0];
				this.month = Number.parseInt(date.match(/-(\d{2})/)[1]);
			},

  

posted on 2020-11-24 09:38  云的旋律  阅读(1911)  评论(0编辑  收藏  举报

导航

前端攻城狮分享群