xm-select/docs/mds/ZM02.md
2019-11-23 20:10:47 +08:00

61 lines
924 B
Markdown

## 表单提交
### 默认表单提交
:::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>
```
:::
### 修改name, 表单验证
```
{
name: 'lalalalalala',
layVerify: 'required',
layVerType: 'tips',
}
```
:::demo
```html
<form class="layui-form">
<div id="demo2" class="xm-select-demo"></div>
<button class="btn" type="submit" lay-submit>提交</button>
</form>
<script>
var demo2 = xmSelect.render({
el: '#demo2',
name: 'lalalalalala',
layVerify: 'required',
layVerType: 'tips',
data: [
{name: '张三', value: 1},
{name: '李四', value: 2},
{name: '王五', value: 3},
]
})
</script>
```
:::