1、html
<div class="layui-inline">
<label class="layui-form-label">过期时间</label>
<div class="layui-input-block">
<input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd"
autocomplete="off" class="layui-input">
</div>
<div class="layui-input-block">
<input type="radio" name="expire_time" lay-filter="expire_time" num="1" value="1个月"
title="1个月">
<input type="radio" name="expire_time" lay-filter="expire_time" num="3" value="3个月"
title="3个月" checked>
<input type="radio" name="expire_time" lay-filter="expire_time" num="6" value="半年"
title="半年" checked>
</div>
</div>
2、js
layui.use(['form', 'laydate'], function () {
var form = layui.form
, laydate = layui.laydate;
// 日期
var date = new Date();
var now_time = '' + date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + '';
laydate.render({
elem: '#date',
min: now_time // 最小不能小于今天,即今天之前的日期不能选择
});
})
网友评论