⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@supermajinbo
Copy link

        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月';
            }
        });

            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月';
                }
            });
@tonyChenHey
Copy link

tonyChenHey commented Feb 25, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants