跳转页面获取id
点击查看按钮需要跳转页面
在index.vue页面下
<el-button type="primary" size="small" @click="lookClick(scope.row.id)">查看</el-button>
lookClick(id){
this.$router.push({
path:`/iot/labelManage/lookLabel/${id}` //需要跳转的路径
})
},
在lookLabel.vue页面中通过this.$route.params.id就可以获取到index.vue中的那一行数据的id
// 返回上一页并关闭当前页
goBack(){
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.go(-1);
}
表单清空的方法
this.ruleForm = this.$options.data().ruleForm; //数据重置
this.$refs.ruleForm?.resetFields();
<el-form ref="ruleForm" :model="ruleForm" label-width="auto" :rules="rules">
//....
</el-form>