# boolean

# 描述

# 数据校验

  • boolean 类型 truefalse

如下演示:schema ui-schema error-schema 相关配置

<template>
    <vue-form
        v-model="formData"
        :schema="schema"
        :ui-schema="uiSchema"
        :error-schema="errorSchema"
    >
        <div slot-scope="{ formData }">
            <pre style="background-color: #eee;">{{ JSON.stringify(formData, null, 4) }}</pre>
        </div>
    </vue-form>
</template>
<script>
   export default {
        data() {
            return {
                formData: {},
                schema: {
                    title: '演示:type boolean',
                    type: 'object',
                    properties: {
                        switch: {
                            type: 'boolean',
                            title: '开还是关'
                        }
                    }
                },
                uiSchema: {
                    switch: {
                        'ui:options': {
                            activeText: '开',
                            inactiveText: '关'
                        }
                    }
                },
                errorSchema: {}
            }
        }
   }
</script>
显示代码
复制代码 | 在线运行
最后更新时间: 7/18/2021, 2:44:30 PM