jquery-weui icon indicating copy to clipboard operation
jquery-weui copied to clipboard

日历通过setValue方法设置日期有错误

Open guitarist0207 opened this issue 7 years ago • 3 comments

日历设置好像是有问题,使用最新1.0.1版。

  • 运行环境: Chrome 60.0.3112.78(正式版本) (64 位) jquery-2.1.4

  • 从BootCDN引入一下资源文件: jquery-weui.js 1.0.1 (标签:) weui.min.css 1.1.1 (标签:) jquery-weui.mini.css 1.0.1 (标签:)

  • 代码 $("#end_date").calendar("setValue", ["2017-08-11"]);

  • 错误信息 jquery-weui.js:5457 Uncaught TypeError: Cannot read property 'eq' of undefined at Calendar.p.setYearMonth (jquery-weui.js:5457) at Calendar.p.setValue (jquery-weui.js:5005) at HTMLInputElement. (jquery-weui.js:5735) at Function.each (jquery.js:374) at jQuery.fn.init.each (jquery.js:139) at jQuery.fn.init.$.fn.calendar (jquery-weui.js:5709) at setInfo (card_register.jsp:301) at Object.success (card_register.jsp:203) at fire (jquery.js:3099) at Object.fireWith [as resolveWith] (jquery.js:3211) Calendar.p.setYearMonth @ jquery-weui.js:5457 Calendar.p.setValue @ jquery-weui.js:5005 (anonymous) @ jquery-weui.js:5735 each @ jquery.js:374 each @ jquery.js:139 $.fn.calendar @ jquery-weui.js:5709 setInfo @ card_register.jsp:301 success @ card_register.jsp:203 fire @ jquery.js:3099 fireWith @ jquery.js:3211 done @ jquery.js:8264 (anonymous) @ jquery.js:8605 XMLHttpRequest.send (async) send @ jquery.js:8630 ajax @ jquery.js:8166 getCardBaseInfo @ card_register.jsp:191 onClose @ card_register.jsp:349 Select.onClose @ jquery-weui.js:4820 (anonymous) @ jquery-weui.js:4811 (anonymous) @ jquery-weui.js:4592 fireCallBack @ jquery-weui.js:19 dispatch @ jquery.js:4435 elemData.handle @ jquery.js:4121

guitarist0207 avatar Aug 15 '17 02:08 guitarist0207

你是不是没有初始化。需要先初始化再设置

lihongxun945 avatar Nov 20 '17 08:11 lihongxun945

我初始化之后也是不行的 代码如下: $("input[name='dDate']").calendar({dateFormat:'yyyy-mm-dd'});; $("input[name='dDate']").calendar("setValue", ['2015-10-10']); //设置日期

错误信息: Uncaught TypeError: Cannot read property 'eq' of undefined

dingrz avatar Apr 28 '18 08:04 dingrz

变通实现"setValue"功能:

$("#birth").val(birth); $("#birth").calendar("destroy"); $("#birth").calendar({value:[birth]});

keylyf avatar Jul 25 '19 04:07 keylyf