7***@qq.com
7***@qq.com
  • 发布:2019-03-25 17:41
  • 更新:2019-10-28 14:08
  • 阅读:1370

dtpicker 开始、结束日期设置了为何会无效??求大神指教!

分类:MUI

官方提供代码:
var dtpicker = new mui.DtPicker({
type: "datetime",//设置日历初始视图模式
beginDate: new Date(2015, 04, 25),//设置开始日期
endDate: new Date(2016, 04, 25),//设置结束日期
labels: ['Year', 'Mon', 'Day', 'Hour', 'min'],//设置默认标签区域提示语
customData: {
h: [
{ value: 'AM', text: 'AM' },
{ value: 'PM', text: 'PM' }
]
}//时间/日期别名
})
dtpicker.show(function(e) {
console.log(e);
})

这种方式也是不行的。

然后,在结构中添加 data-options='{"beginDate":"2012,10,1","endDate":"2029,12,1","beginYear":"2013","endYear":2020}',开始、结束日期依然无效,开始、结束年份,是有效的。
(无法上传图片,便不能直观看结果了,但开始、结束日期确实是无效的。)

代码 :
var optionsJson = this.getAttribute('data-options') || '{}';
var options = JSON.parse(optionsJson);

//options.beginYear = new Date().getFullYear() - 100;
//options.endYear = new Date().getFullYear() + 100;
//options.beginDate = new Date(2011, 04, 25); //设置开始日期
//options.endDate = new Date(2016, 04, 25); //设置结束日期

var dtPicker = new mui.DtPicker(options);//创建日期时间对象

求大神赐教,找了好久还是不知道为何。引用的样式、脚本已经是直接 copy 官网提供的最新版了。看了下官网提供的示例代码 http://www.dcloud.io/hellomui/examples/dtpicker.html 中也并未使用 beginDate、endDate,难道是本来就无效的 ???求大神赐教!

2019-03-25 17:41 负责人:无 分享
已邀请:
tingyu66

tingyu66

我也是碰到这个问题,后面我看mui.picker.js里面只有beginYear,压根没有beginDate参数。然后网上一顿找也没找到,最后用HBuilder X新建项目里面添加mui,然后在mui.picker.all.js里面找到了这个参数,就能用了!

该问题目前已经被锁定, 无法添加新回复