<el-dialog-x :title="title" :visible.sync="foldDialogVisible">
<el-form-x ref="foldForm" :group-fields="foldFields" :buttons="foldFormButtons"
label-width="120px" ></el-form-x>
</el-dialog-x>
以上是前端html书写的代码
js中代码如下
foldFields: [{
columnCount: 1,
fields: [
{
field: 'rootor', label: '根节点', type: "switch", change: function (rootor) {
if (rootor == true) {
this.rootOr = true;
} else {
this.rootOr = false;
}
}
},
{
field: 'constNm', label: '文件夹名称',type: "input", rules: [
{required: true, message: '必填项', trigger: 'blur'},
{max: 90, message: '输入值过长', trigger: 'blur'},
{validator: yufp.validator.trim, message: '输入项首尾有空格', trigger: 'blur'},
{validator: yufp.validator.speChar, message: '输入信息包含特殊字符', trigger: 'blur'},
{validator: yufp.validator.setCode, message: '名称不能数字开头', trigger: 'blur'}
]
},
{field: 'constDesc', label: '描述', type: "textarea", hidden: true, limitChar: {}},
{field: 'pjtCde', label: '项目编号', type: "textarea", hidden: true},
{field: 'parConstId', label: '父节点', type: "textarea", defaultValue: "", hidden: true},
{field: 'constId', label: '主键', type: "textarea", hidden: true},
{field: 'nodeTyp', label: '节点类型', type: "input", hidden: true},
{field: 'path', label: '路径', type: "input", hidden: true}
]
}],
页面效果如上,每次鼠标点击输入框后,不管是否输入数据,回车,都会跑到首页。查询好久无果。终于找到一丝线索
在form标签中增加 @submit.native.prevent
修改后代码如下
<el-dialog-x :title="title" :visible.sync="foldDialogVisible">
<el-form-x ref="foldForm" :group-fields="foldFields" :buttons="foldFormButtons"
label-width="120px" @submit.native.prevent></el-form-x>
</el-dialog-x>
这样就不会出现这个情况了。
原因 好像是W3C标准中有一条: