diff --git a/wg-basic/page-unit.md b/wg-basic/page-unit.md index 1d99fbe..2aaa404 100644 --- a/wg-basic/page-unit.md +++ b/wg-basic/page-unit.md @@ -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 +
+ +
+ + +
+
+``` +# 4. 表单多选 +```html +
+ +
+ + + + + +
+
+``` +处理多选结果 +```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'); ``` \ No newline at end of file