快捷搜索:  汽车  科技

element ui获取提交表单数据(Elementui的form表单提交出现如下报错的解决办法)

element ui获取提交表单数据(Elementui的form表单提交出现如下报错的解决办法)

首先,element ui 出现如下报错:

element ui获取提交表单数据(Elementui的form表单提交出现如下报错的解决办法)(1)

代码: <el-form :model="formData" :rules="rules" ref="formData"> <el-form-item prop="name"> <div class="activity-name">活动名称<span class="red">*</span></div> <member-activity-name-input v-model="formData.name"></member-activity-name-input> </el-form-item> <el-form-item prop="type"> <div class="activity-name">使用场景<span class="red">*</span></div> <member-activity-scene-selector v-model="formData.type"></member-activity-scene-selector> </el-form-item> <el-form-item prop="sendType"> <div class="activity-name">触达通路<span class="red">*</span></div> <member-activity-channel-selector v-model="formData.sendType" @select-value="channelChanged" ></member-activity-channel-selector> </el-form-item> <div v-if="formData.sendType === 'SMS'"> <el-form-item prop="requireType"> <div class="activity-name">短信类型<span class="red">*</span></div> <member-activity-smstype-selector v-model="formData.requireType"></member-activity-smstype-selector> </el-form-item> </div> <el-form-item prop="remarks"> <div class="activity-name">备注<span class="red">*</span></div> <el-input type="textarea" placeholder="输入备注信息" v-model="formData.remarks" class="comments"show-word-limit maxlength="200"></el-input> </el-form-item> <el-form-item > <div class="activity-name mb15">状态<span class="red">*</span></div> <el-radio-group v-model="formData.isDel"> <el-radio label="1">已激活</el-radio> <el-radio label="2">未激活</el-radio> </el-radio-group> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> <el-button type="primary" @click="handleClose('formData')" class="next">下一步</el-button> </span>

//js方法 handleClose(formName) { // this.rules this.$refs[formName].validate((valid) => { if (valid) { alert('submit!'); this.dialogVisible= false; this.targetVisible=true; } else { console.log('error submit!!'); return false; } });

错误代码:

element ui获取提交表单数据(Elementui的form表单提交出现如下报错的解决办法)(2)

正确代码:

<span slot="footer" class="dialog-footer"> <el-button type="primary" @click="handleClose('formData')" class="next">下一步</el-button> </span>

错误原因:少加了一个‘’

猜您喜欢: