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]);
			},

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM