xm-select/docs/mds/ZM02.md

61 lines
924 B
Markdown
Raw Normal View History

2019-11-19 12:13:50 +00:00
## 表单提交
### 默认表单提交
:::demo
```html
<form>
<div id="demo1" class="xm-select-demo"></div>
<button class="btn" type="submit">提交</button>
</form>
<script>
var demo1 = xmSelect.render({
el: '#demo1',
data: [
{name: '张三', value: 1},
{name: '李四', value: 2},
{name: '王五', value: 3},
]
})
</script>
```
:::
2019-11-23 12:10:47 +00:00
### 修改name, 表单验证
```
{
name: 'lalalalalala',
layVerify: 'required',
layVerType: 'tips',
}
```
2019-11-19 12:13:50 +00:00
:::demo
```html
2019-11-23 12:10:47 +00:00
<form class="layui-form">
2019-11-19 12:13:50 +00:00
<div id="demo2" class="xm-select-demo"></div>
2019-11-23 12:10:47 +00:00
<button class="btn" type="submit" lay-submit>提交</button>
2019-11-19 12:13:50 +00:00
</form>
<script>
var demo2 = xmSelect.render({
el: '#demo2',
2019-11-23 12:10:47 +00:00
name: 'lalalalalala',
layVerify: 'required',
layVerType: 'tips',
2019-11-19 12:13:50 +00:00
data: [
{name: '张三', value: 1},
{name: '李四', value: 2},
{name: '王五', value: 3},
]
})
</script>
```
2019-11-23 12:10:47 +00:00
:::