-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
Description
重现链接
<!--pages/demo/demo.wxml-->
<view style="padding-top:150px;">
<van-datetime-picker
type="date"
value="{{ currentDate }}"
bind:input="onInput"
min-date="{{ minDate }}"
formatter="{{ formatter }}"
/>
</view>
<view style="padding-top:50px;">
<van-button bindtap="clickChoose">往后选6个月</van-button>
</view>
Page({
data: {
currentDate: new Date().getTime(),
minDate: new Date().getTime(),
formatter(type, value) {
if (type === 'year') {
return `${value}年`;
}
if (type === 'month') {
return `${value}月`;
}
return value;
},
},
onInput(event) {
this.setData({
currentDate: event.detail,
});
},
clickChoose() {
const cur = this.data.currentDate
this.setData({
currentDate: cur + 1000 * 60 * 60 * 24 * 30 * 6
})
}
});
Vant Weapp 版本
1.11.7
描述一下你遇到的问题。
直接点击按钮,通过this.setData设置时间选择器的值,会没有滚动动画;
当手势触摸滑动选择框后,再通过点击按钮js设置值,是会有预期的滚动动画。
查看@vant/weapp/lib/picker-column/index.js 发现DEFAULT_DURATION的值没有被设置在this.data.duration的初始值上。
重现步骤
重现链接中的代码demo,打开后直接点击按钮设置时间没有动画,手势触摸滑动时间选择器后再点按钮设置时间即可有动画
设备/浏览器
No response