代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>activeForm</title>
<link rel="stylesheet" href="./layui/css/layui.css">
</head>
<body>
<button id="qz" style="margin-bottom: 40px;margin-left: 40px">取值</button>
<span id="sdf"></span>
<div id="container">
</div>
<script src="./layui/layui.js"></script>
<script src="activeForm.js"></script>
<script>
layui.extend({
xmSelect: 'xm-select',
activeForm: 'activeForm'
}).use(['activeForm', 'form', 'jquery'], function () {
var form = layui.form
var $ = layui.jquery
var table_3Inst = new layui.activeForm({
el: '#container',
disabled: false,
columns: [
{
title: '',
type: 'checkbox',
field: '',
},
{
title: '线路',
type: 'select',
field: 'line',
required:true,
alternative: [{
value: '1',
name: 'A线'
}, {
value: 'b',
name: 'B线'
}],
onChange: function (value, row_uuid) {
$('[data-uuid="' + row_uuid + '"]').find('[name="tower"]').html('<option>请选择</option><option value="6">#6</option>')
form.render()
}
},
{
title: '杆塔',
type: 'select',
field: 'tower'
},
{
title: '飞手',
type: 'multi-select',
field: 'feishou',
xmSelectOption: {
data: [{
value: 'zhangsan',
name: '张三',
selected: true
}, {
value: 'lisi',
name: '李四'
}],
}
},
{
title: '备注',
type: 'input',
field: 'remark'
}
],
data: [{
line: {
currSelectedValue: '1',
},
tower: {
alternative: [{
value: '1',
name: '#1'
}, {
value: '2',
name: '#2'
}],
currSelectedValue: '2',
},
feishou: {
xmSelectOption: {
data: [{
value: 'zhangsan',
name: '张三2',
selected: true
}, {
value: 'lisi',
name: '李四2'
}],
}
},
remark: '测试的备注'
}, {
line: {
currSelectedValue: '1',
},
tower: {
alternative: [{
value: '1',
name: '#1'
}, {
value: '2',
name: '#2'
}],
currSelectedValue: '2',
},
feishou: {},
remark: '测试的备注2'
}],
},
);
$('#qz').on('click',function () {
console.log(table_3Inst.getValue())
$('#sdf').html(JSON.stringify(table_3Inst.getValue()))
})
})
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。