<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline">
<select name="type_select" lay-filter="type_select" id="type_select">
<option value="1">收入</option>
<option value="2">支出</option>
</select>
</div>
<div class="layui-input-inline">
<select nam="pay_select" lay-filter="pay_select" id="pay_select">
<option value="1">支付宝</option>
<option value="2">微信</option>
<option value="3">银联</option>
</select>
</div>
<div class="layui-input-inline">
<input type="input" class="layui-input" id="dateinput" style="width: 300px">
</div>
</div>
</div>
form.on("select(type_select)", function (data) {
if (data.value == 2) {
console.log(data.value);
form.render();// 因为是动态写入的数据所以需要先渲染表单再进行以下步骤
var select = 'dd[lay-value=' + 3 + ']';// 设置value
$('#pay_select').siblings("div.layui-form-select").find('dl').find(select).click();
$('#pay_select').prop("disabled", "disabled");
form.render('select');// 再次渲染select
} else if (data.value == 1) {
form.render();
$('#pay_select').prop("disabled", "");
form.render();
}
});