layui日期组件更新结束时间

//注意以下that.×××是因为我用的layui+vue 所以纯使用layui的读者需要更改that.××× = 要更改为var ××× =
// 查询开始日期 insStart不需要定义
that.insStart = that.laydate.render({
    elem: '#startDetectDate'
    , showBottom: true
    , value: that.startDetectDate
    , trigger: 'click'
    , done: function (value, date) {
        //更新结束日期的最小日期
        that.insEnd.config.min = lay.extend({}, date, {
            month: date.month - 1
        });
    }
});
// 查询结束日期 insEnd不需要定义
that.insEnd = that.laydate.render({
    elem: '#endDetectDate'
    , min: 0
    , showBottom: true
    , value: that.endDetectDate
    , trigger: 'click'
    , done: function (value, date) {
        //更新开始日期的最大日期
        /*that.insStart.config.max = lay.extend({}, date, {
            month: date.month - 1
        });*/
    }
});

记一次日期组件的问题:layui日期组件在第一次渲染完成后 进行重复的form.render()渲染是不会生效的所以我们只能让组件强制的去渲染,如下操作

 <div class="layui-input-inline layui-input-i-icon" id="reloadDate">
	<i class="layui-icon layui-icon-date"></i>
	<input type="text" class="layui-input" autocomplete="off" id="firstUseDate1" lay-verify="required" lay-verType="tips" readonly>
</div>
if (that.insEnd) {
    that.$('#firstUseDate1').remove();
    that.$('#reloadDate').append('<input type="text" class="layui-input" autocomplete="off" id="firstUseDate1" lay-verify="required" lay-verType="tips" readonly>');
    that.insEnd = that.laydate.render({
        elem: '#endDetectDate'
        , showBottom: true
        , type: 'date'
        , max: moment().format('YYYY-MM-DD')
        , min: data.setUpDate
        , value: new Date()
        , trigger: 'click'
        , done: function (value, d) {
           
        }
    });
} else {
	that.$nextTick(function () {
	    //开始日期
	    that.insEnd = that.laydate.render({
	        elem: '#endDetectDate'
	        , showBottom: true
	        , type: 'date'
	        , max: moment().format('YYYY-MM-DD')
	        , min: data.setUpDate
	        , trigger: 'click'
	        , done: function (value, d) {
	            
	        }
	    });
	});
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值