1 Star 1 Fork 1

hsw/activeForm_layui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 4.27 KB
一键复制 编辑 原始数据 按行查看 历史
hsw 提交于 2020-08-30 10:15 . 1
<!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>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hsw0/active-form_layui.git
git@gitee.com:hsw0/active-form_layui.git
hsw0
active-form_layui
activeForm_layui
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385