uView フレームワークの DatetimePicker セレクターがデフォルト値を設定する

要件は、ページに表示される日付がクリックされたときの日付であることです。

 uview ドキ​​ュメントには、各列のデフォルトのインデックスを設定するためのdefaultIndex 属性がありますが、効果はありません。

解決策: innerValue を使用する

1. セレクターに ref を追加します

	<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. クリックして日付ポップアップ ボックスを表示する場所に使用します。

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

おすすめ

転載: blog.csdn.net/weixin_69666355/article/details/131372719