laydate icon indicating copy to clipboard operation
laydate copied to clipboard

对象初始化完成后,通过对象修改format后不生效

Open supermajinbo opened this issue 7 years ago • 1 comments

        var startDate = laydate.render({
            elem: '#startDate', //指定元素 #startDate是一个input
            type: 'date',
            format: 'yyyy年MM月dd日',
            isInitValue: true, //是否允许填充初始值,默认为 true
            done: function(value, date, endDate) {
                /*回调里修改了type 和format 发现type的修改生效了,但是formar的修改没有生效,看源码发现是没有更新this.format、that.EXP_IF和that.EXP_SPLIT。(PS:这里只是举例,实际项目中是通过别的按钮触发改变type和format 事件的。) */
                startDate .config.type = 'month';
                startDate .config.format = 'yyyy年MM月';
            }
        });

supermajinbo avatar Aug 02 '18 10:08 supermajinbo

通过选择完日期后再修改type和format很少哇 遇到的场景是 function _initCalendar(_this, range) { laydate.render({ type: range,//通過某事件触发修改type实现日期选择精度的修改 elem: _this[0] //指定元素 }); } 可惜不生效

tonyChenHey avatar Feb 25 '19 03:02 tonyChenHey