Commit a0425096 authored by yyh's avatar yyh

返回提示保存

parent 807c4062
......@@ -17,6 +17,7 @@ import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
import { Button, Field } from 'vant';
import TemplateDetail from '@/components/TemplateDetail.vue';
import { TemplateDataItem } from '@/const/interface';
import { Route } from 'vue-router';
@Component({
components: {
[Button.name]: Button,
......@@ -32,6 +33,8 @@ export default class ProofDetail extends Vue {
private detail2: string = '' ;
private name2: string = '';
private checkEdited: boolean = true;
@Prop({
})
private templateId!: number;
......@@ -61,7 +64,8 @@ export default class ProofDetail extends Vue {
this.showBtn = true;
}
}
private beforeRouteLeave(to: any, from: any, next: any) {
private beforeRouteLeave(to: Route, from: Route, next: () => void) {
if(!this.checkEdited) return next();
if ( this.name !== this.name2 || JSON.stringify(this.detail) !== this.detail2 ) {
this.$dialog.confirm({
title: '提示',
......@@ -94,6 +98,7 @@ export default class ProofDetail extends Vue {
} else {
await this.$api.proof.add(this.name, this.detail);
}
this.checkEdited = false;
this.$router.push({name: 'ProofList'});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment