表单提交向别的组件传参失效
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
//这句话至关重
this.$router.push("/test/"+this.numberValidateForm.age)
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
路由传参格式
//带参转跳
<router-link to="/cr">children-router</router-link><router-link :to="{name:'Test',params:{age:numberValidateForm.age}}">test</router-link>
<el-menu-item index="4" :index="'test/1'" >
//不带参转跳
<el-menu-item index="4" :index="'test'" >
//转跳至 http://localhost:8080/#/test?age=1
<el-menu-item index="4" :route="{ path: '/test', query: { age:1 }} ">