增加验证规则 <u-form :model="form" :rules="rules" ref="uForm" :errorType="errorType"> <navigator url="../LevineHua-editor/LevineHua-editor" class="single"> <u-form-item label="荣誉照片" prop="container" label-width="150"> <input placeholder="请输入荣誉照片" v-model="form.container" type="texarea" /> </u-form-item> </navigator>
//提交 submit() { //验证 this.$refs.uForm.validate(valid => { if (valid) { this.form.marketId = this.vuex_user.market_id this.form.createdBy = this.vuex_user.name this.form.loginId = this.vuex_user.id //接口请求 this.$u.api.getHonorAdd(this.form).then(res => { if (res.data.code == 200) { this.$refs.uToast.show({ title: res.data.message, type: 'success', back: true }) }else{ this.$refs.uToast.show({ title: res.data.message, type: 'error', }) } }) } else { console.log('验证失败') } }) },