docs: update wg-basic/page-unit
This commit is contained in:
parent
c98809359e
commit
7d1a29a0c7
@ -2,7 +2,7 @@
|
||||
title: 页面组件
|
||||
description: 页面上使用的组件
|
||||
published: true
|
||||
date: 2021-09-08T06:43:45.505Z
|
||||
date: 2021-09-08T06:45:19.292Z
|
||||
tags: wg-basic
|
||||
editor: markdown
|
||||
dateCreated: 2021-09-08T06:41:19.351Z
|
||||
@ -110,4 +110,42 @@ initArea2Select(data['area1'], data['area2']);
|
||||
form.on('select(area1)', function(data) {
|
||||
initArea2Select(data.value);
|
||||
});
|
||||
```
|
||||
# 3. 表单单选
|
||||
```html
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="isLogOff" value="0" title="否" checked>
|
||||
<input type="radio" name="isLogOff" value="1" title="是">
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
# 4. 表单多选
|
||||
```html
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">授权模式 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="authorizedGrantTypes[authorization_code]" title="授权码模式" checked>
|
||||
<input type="checkbox" name="authorizedGrantTypes[password]" title="密码模式">
|
||||
<input type="checkbox" name="authorizedGrantTypes[client_credentials]" title="客户端模式" checked>
|
||||
<input type="checkbox" name="authorizedGrantTypes[implicit]" title="简单模式">
|
||||
<input type="checkbox" name="authorizedGrantTypes[refresh_token]" title="刷新" checked>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
处理多选结果
|
||||
```javascript
|
||||
var authorizedGrantTypes = top.restAjax.checkBoxToString(formData.field, 'authorizedGrantTypes');
|
||||
formData.field.authorizedGrantTypes = authorizedGrantTypes;
|
||||
```
|
||||
赋值多选结果
|
||||
```javascript
|
||||
var authorizedGrantTypes = data.authorizedGrantTypes.split(',');
|
||||
var formObj = {};
|
||||
for(var i = 0, item = authorizedGrantTypes[i]; item = authorizedGrantTypes[i++];) {
|
||||
formObj['authorizedGrantTypes['+ item +']'] = true;
|
||||
form.val('dataForm', formObj);
|
||||
}
|
||||
form.render(null, 'dataForm');
|
||||
```
|
Loading…
Reference in New Issue
Block a user