guang
guang
  • 发布:2021-12-20 15:17
  • 更新:2022-05-09 18:08
  • 阅读:1203

动态生成表单,出现Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

分类:uni-app

想通过服务器返回的数据动态生成表单,表单是生成了,但访问时发生错误:

15:00:19.379 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.382 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)
15:00:19.383 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.388 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)
15:00:19.389 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.394 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)
15:00:19.396 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.403 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)
15:00:19.404 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.409 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)
15:00:19.413 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'updateSchema' of undefined"

found in

---> <UniFormsItem> at uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue
<UniForms> at uni_modules/uni-forms/components/uni-forms/uni-forms.vue
at pages/appointment/test/test.vue
15:00:19.413 [system]TypeError: Cannot read property 'updateSchema' of undefined
at VueComponent.init (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:235:21)
at VueComponent.mounted (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!F:\uniappproject\mhopeson\uni_modules\uni-forms\components\uni-forms-item\uni-forms-item.vue?vue&type=script&lang=js&:181:10)
at invokeWithErrorHandling (http://localhost:8080/static/js/chunk-vendors.js:5212:57)
at callHook (http://localhost:8080/static/js/chunk-vendors.js:7618:7)
at Object.insert (http://localhost:8080/static/js/chunk-vendors.js:6535:7)
at invokeInsertHook (http://localhost:8080/static/js/chunk-vendors.js:9741:28)
at VueComponent.patch [as patch] (http://localhost:8080/static/js/chunk-vendors.js:9960:5)
at VueComponent.Vue._update (http://localhost:8080/static/js/chunk-vendors.js:7341:19)
at VueComponent.updateComponent (http://localhost:8080/static/js/chunk-vendors.js:7459:10)
at Watcher.get (http://localhost:8080/static/js/chunk-vendors.js:7878:25)

vue文件内容:————————————————————————


 <template>  
    <view class="container">  

        <view class="example">  
            <uni-forms ref="baseForm2" :modelValue="baseFormData2">  
                <uni-forms-item v-for="(item,index) in formlist" :key="item.id" :label="item.label" :required="item.required" :rules="item.rules" :name="item.name">   
                    <uni-easyinput v-if="item.type=='input'" v-model="baseFormData2[item.vmodel]" :placeholder="item.placeholder" />  
                    <uni-data-checkbox v-if="item.type=='checkbox'" v-model="baseFormData2[item.vmodel]" :localdata="item.localdata" />  
                </uni-forms-item>  
            </uni-forms>   
            <button type="primary" @click="submit('baseForm2')">提交</button>  
        </view>  

        <uni-section title="动态表单" type="line">  
            <view class="example">  
                <!-- 动态表单校验 -->  
                <uni-forms ref="dynamicForm" :rules="dynamicRules" :modelValue="dynamicFormData">  
                    <uni-forms-item label="邮箱" required name="email">  
                        <uni-easyinput v-model="dynamicFormData.email" placeholder="请输入姓名" />  
                    </uni-forms-item>  
                    <uni-forms-item v-for="(item,index) in dynamicLists" :key="item.id" :label="item.label+' '+index"  
                        required :rules="item.rules" :name="'domains[' + item.id + ']'">  
                        <view class="form-item">  
                            <uni-easyinput v-model="dynamicFormData.domains[index]" placeholder="请输入域名" />  
                            <button class="button" size="mini" type="default" @click="del(item.id)">删除</button>  
                        </view>  
                    </uni-forms-item>  
                </uni-forms>  
                <view class="button-group">  
                    <button type="primary" size="mini" @click="add">新增域名</button>  
                    <button type="primary" size="mini" @click="submit('dynamicForm')">提交</button>  
                </view>  
            </view>  
        </uni-section>  
    </view>  
</template>  

<script>  
    import ldata from './index.js' //注意路径  
    export default {  
        data() {  
            return {  
                option:ldata,  
                formlist:ldata.formlist,  
                formlistname:ldata.formlistname,  
                hobbys:ldata.hobbys,  
                baseFormData2: {  
                    name: 'aaaa',  
                    age: '10',  
                    introduction: '',  
                    sex: 1,  
                    maritalstatus:0,  
                    children:0,  
                    datetimesingle: 1627529992399,  
                    smoke:0,  
                    formlistname:ldata.formlistname,  
                },  
                // 基础表单数据  
                baseFormData: {  
                    name: 'abc',  
                    age: '',  
                    introduction: '',  
                    sex: 2,  
                    hobby: [5],  
                    maritalstatus:0,  
                    children:0,  
                    datetimesingle: 1627529992399,  
                    smoke:0,  
                },  
                // 表单数据  
                alignmentFormData: {  
                    name: '',  
                    age: '',  
                },  

                // 分段器数据  
                current: 0,  
                items: ['左对齐', '顶部对齐','右对齐'],  
                // 校验表单数据  
                valiFormData: {  
                    name: '',  
                    age: '',  
                    introduction: '',  
                },  
                // 校验规则  
                rules: {  
                    name: {  
                        rules: [{  
                            required: true,  
                            errorMessage: '姓名不能为空'  
                        }]  
                    },  
                    age: {  
                        rules: [{  
                            required: true,  
                            errorMessage: '年龄不能为空'  
                        }, {  
                            format: 'number',  
                            errorMessage: '年龄只能输入数字'  
                        }]  
                    }  
                },  
                // 自定义表单数据  
                customFormData: {  
                    name: '',  
                    age: '',  
                    hobby: []  
                },  
                // 自定义表单校验规则  
                customRules: {  
                    name: {  
                        rules: [{  
                            required: true,  
                            errorMessage: '姓名不能为空'  
                        }]  
                    },  
                    age: {  
                        rules: [{  
                            required: true,  
                            errorMessage: '年龄不能为空'  
                        }]  
                    },  
                    hobby: {  
                        rules: [{  
                                format: 'array'  
                            },  
                            {  
                                validateFunction: function(rule, value, data, callback) {  
                                    if (value.length < 2) {  
                                        callback('请至少勾选两个兴趣爱好')  
                                    }  
                                    return true  
                                }  
                            }  
                        ]  
                    }  

                },  
                dynamicFormData: {  
                    email: 'aaaavbbb',  
                    domains: {0:'01',1:'02',3:'03'}  
                },  
                dynamicLists: [],  
                dynamicRules: {  
                    email: {  
                        rules: [{  
                            required: true,  
                            errorMessage: '域名不能为空'  
                        }, {  
                            format: 'email',  
                            errorMessage: '域名格式错误'  
                        }]  
                    }  
                }  
            }  
        },  
        computed: {  
            // 处理表单排列切换  
            alignment() {  
                if (this.current === 0) return 'left'  
                if (this.current === 1) return 'top'  
                return 'left'  
            }  
        },  
        onLoad() {},  
        onReady() {  
            // 设置自定义表单校验规则,必须在节点渲染完毕后执行  
            //this.$refs.customForm.setRules(this.customRules)  
        },  
        methods: {  
            bindPickerChange:ldata.bindPickerChange,  
            onClickItem(e) {  
                console.log(e);  
                this.current = e.currentIndex  
            },  
            add() {  
                this.dynamicLists.push({  
                    label: '域名',  
                    rules: [{  
                        'required': true,  
                        errorMessage: '域名项必填'  
                    }],  
                    id: Date.now()  
                })  
            },  
            del(id) {  
                let index = this.dynamicLists.findIndex(v => v.id === id)  
                this.dynamicLists.splice(index, 1)  
            },  
            submit(ref) {  
                this.$refs[ref].validate().then(res => {  
                    console.log('success', res);  
                    uni.showToast({  
                        title: `校验通过`  
                    })  
                }).catch(err => {  
                    console.log('err', err);  
                })  
            },  
        }  
    }  
</script>  

<style lang="scss">  
    .container {  
        padding: 10px;  
        font-size: 15px;  
    }  
    .segmented-control {  
        margin-bottom: 15px;  
    }  

    .button-group {  
        margin-top: 15px;  
        display: flex;  
        justify-content: space-around;  
    }  

    .form-item {  
        display: flex;  
        align-items: center;  
    }  

    .button {  
        display: flex;  
        align-items: center;  
        height: 35px;  
        margin-left: 10px;  
    }  
</style>```   

导入的动态数据的内容:------------------------------------
```javascript  
const bindPickerChange= function(e) {  
        console.log('picker发送选择改变,携带值为:' + e.detail.value)  
        this.baseFormData.children = e.detail.value;  
    }  
const formlistname=['name','lastname','firstname','oldname','sex','maritalstatus'];  
const formlist=[  
    {label: '中文姓名',  
        type:'input',  
        rules: [{  
            'required': true,  
            errorMessage: '中文姓名必填'  
        }],  
        required:true,  
        placeholder:'请输入中文姓名',  
        vmodel:'name',  
        id: 0,  
        name:'name'},  
    {label: '英文姓',  
        type:'input',  
        rules: [{  
            'required': true,  
            errorMessage: '英文姓必填'  
        }],  
        required:true,  
        placeholder:'请输入英文姓氏',  
        vmodel:'lastname',  
        id: 1,  
        name:'lastname'},  
    {label: '英文名',  
        type:'input',  
        rules: [{  
            'required': true,  
            errorMessage: '英文名必填'  
        }],  
        required:true,  
        placeholder:'请输入英文名',  
        vmodel:'firstname',  
        id: 2,  
        name:'firstname'},  
    {label: '曾用名',  
        type:'input',  
        rules: [{  
            'required': false,  
            errorMessage: '曾用名非必填'  
        }],  
        required:false,  
        placeholder:'请输入曾用名',  
        vmodel:'oldname',  
        id: 3,  
        name:'oldname'},  
    {label: '性别',  
        type:'checkbox',  
        rules: [{  
            'required': true,  
            errorMessage: '性别必填'  
        }],  
        required:true,  
        localdata:[{text: '男',value: 1}, {text: '女',value: 2}],  
        vmodel:'sex',  
        id: 4,  
        name:'sex'},  
    {label: '婚姻状况',  
        type:'checkbox',  
        rules: [{  
            'required': true,  
            errorMessage: '婚姻状况必填'  
        }],  
        required:true,  
        localdata:[{text: '单身',value: 0}, {text: '已婚',value: 1}, {text: '离婚',value: 2}, {text: '鳏寡',value: 3}],  
        vmodel:'maritalstatus',  
        id: 5,  
        name:'maritalstatus'},  
]  
export default {  
    childrens: [{name:'无'},{name: '1个'}, {name:'2个'}, {name:'3个'}, {name:'4个'}, {name:'5个'}, {name:'6个'}, {name:'7个'}, {name:'8个'}, {name:'9个'}, {name:'10个'}],  
    // 单选数据源  
    sexs: [{text: '男',value: 1}, {text: '女',value: 2}],  
    // 单选数据源  
    smokeoption: [{text: '不吸烟',value: 0}, {text: '吸烟',value: 1}, {text: '戒烟',value: 2}],  
    // 多选数据源  
    maritals: [{text: '单身',value: 0}, {text: '已婚',value: 1}, {text: '离婚',value: 2}, {text: '鳏寡',value: 3}],  
    hobbys: [{text: '单身',value: 0}, {text: '已婚',value: 1}, {text: '离婚',value: 2}, {text: '鳏寡',value: 3}, {text: '篮球',value: 4}, {text: '其他',value: 5}],  
    cigarette:['雪茄','香烟','电子烟'],  
    bindPickerChange:bindPickerChange,  
    formlist:formlist,  
    formlistname:formlistname,  
}```   

有人遇到过这种情况吗,看能不能帮忙解决?感谢
2021-12-20 15:17 负责人:无 分享
已邀请:
8***@qq.com

8***@qq.com

加入动态表单校验规则就不会报错了

该问题目前已经被锁定, 无法添加新回复