vue2-form-uview

基于 Vue 、uview、JsonSchema快速构建一个带完整校验的form表单

Usage no npm install needed!

<script type="module">
  import vue2FormUview from 'https://cdn.skypack.dev/vue2-form-uview';
</script>

README

vue2-form-uview

基于 uview 、Vue2、 JSON Schema 生成表单

通过 vue2-form-uview 适配 iview3 库

安装

## npm
npm install --save vue2-form-uview

## yarn
yarn add vue2-form-uview

使用

<VueForm
    v-model="formData"
    :schema="schema"
>
</VueForm>
//  使用
import VueForm from 'vue2-form-uview';

export default {
    name: 'Demo',
    components: {
        VueForm
    },
    data() {
        return {
            formData: {},
            schema: {
                type: 'object',
                required: [
                    'userName',
                    'age',
                ],
                properties: {
                    userName: {
                        type: 'string',
                        title: '用户名',
                        default: 'Liu.Jun',
                    },
                    age: {
                        type: 'number',
                        title: '年龄'
                    },
                    bio: {
                        type: 'string',
                        title: '签名',
                        minLength: 10,
                        default: '知道的越多、就知道的越少',
                        'ui:options': {
                            placeholder: '请输入你的签名',
                            type: 'textarea',
                            rows: 1
                        }
                    }
                }
            }
        };
    }
};

License

Apache-2.0