docs_vue2/one/docs/demo/form/withhold.vue
xiaodemen d0dd1ea473 docs: add docs for form
Change-Id: I6b84399995ed28e9fe098abe38465ed5d685fb47
2022-03-30 22:46:18 +08:00

48 lines
770 B
Vue

<template>
<article>
<veui-form
:data="formData"
>
<veui-field
label="名称:"
name="name"
:rules="[{ name: 'required', triggers: 'input,blur' }]"
>
<template #default="{ invalid, listeners }">
<input
:class="{
'demo-invalid': invalid
}"
v-model="formData.name"
v-on="listeners"
>
</template>
</veui-field>
</veui-form>
</article>
</template>
<script>
import { Form, Field } from 'veui'
export default {
components: {
'veui-form': Form,
'veui-field': Field
},
data () {
return {
formData: {
name: ''
}
}
}
}
</script>
<style lang="less" scoped>
.demo-invalid {
border: 1px solid #cc1800;
}
</style>