DatetimePicker selector in uView framework sets default value

The requirement is that the date displayed on the page will be the date when clicked on.

 The uview document has a defaultIndex attribute to set the default index of each column, but it has no effect.

Solution: use innerValue

1. Add ref to the selector

	<u-datetime-picker :maxDate='maxDate' closeOnClickOverlay @close='yearmonthshowClose' immediateChange
			 ref="picker" @cancel='yearmonthshowClose' @confirm='yearmonthshowSure'
			:show="yearmonthshow" v-model="yearmonthvalue" mode="date">
		</u-datetime-picker>

 2. Use it where you click to display the date pop-up box

	//点击显示时间选择器
			yearmonthshowBtn() {
				this.yearmonthshow = true
             //new Date(this.endDate).getTime()为你需要在选择器上显示的时间戳
			    this.$refs.picker.innerValue=new Date(this.endDate).getTime()	
			}

Guess you like

Origin blog.csdn.net/weixin_69666355/article/details/131372719