# 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>
显示代码
复制代码 | 在线运行
最后更新时间: 10/5/2023, 1:52:28 PM