<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
- 发布:2023-07-10 17:45
- 更新:2023-07-11 17:27
- 阅读:484
产品分类: uniCloud/App
示例代码:
操作步骤:
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
预期结果:
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
实际结果:
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" :picker-options="pickerOptions"/>
pickerOptions:{ //禁用当前日期之前的日期
disabledDate(time) {
return time.getTime() < Date.now() - 1 24 60 60 1000;
},
},
bug描述:
如题,多种方法都无效
3 个回复
DCloud_UNI_WZF
(https://uniapp.dcloud.net.cn/component/uniui/uni-datetime-picker.html)[https://uniapp.dcloud.net.cn/component/uniui/uni-datetime-picker.html]
支持 start end 限制可选择时间,你的 picker-options 是啥?
昭昭L - 开心就好
picker-options没这个属性
昭昭L - 开心就好
element的时间控件才有这个属性