Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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