ebd63647 by zhaoqian

重新加载局部刷新

1 parent 08543a78
1 <template> 1 <template>
2 <div id="app"> 2 <div id="app">
3 <router-view /> 3 <router-view v-if="isRouterAlive" />
4 </div> 4 </div>
5 </template> 5 </template>
6 6
7 <script> 7 <script>
8 export default { 8 export default {
9 provide(){
10 return{
11 reload:this.reload
12 }
13 },
14 data(){
15 return{
16 isRouterAlive:true,
17 }
18 },
9 mounted() { 19 mounted() {
10 window.addEventListener("unload", this.saveState); 20 window.addEventListener("unload", this.saveState);
11 }, 21 },
...@@ -13,6 +23,12 @@ export default { ...@@ -13,6 +23,12 @@ export default {
13 saveState() { 23 saveState() {
14 sessionStorage.setItem("state", JSON.stringify(this.$store.state)); 24 sessionStorage.setItem("state", JSON.stringify(this.$store.state));
15 }, 25 },
26 reload(){
27 this.isRouterAlive = false;
28 this.$nextTick(function () {
29 this.isRouterAlive = true;
30 })
31 },
16 }, 32 },
17 }; 33 };
18 </script> 34 </script>
......
...@@ -277,6 +277,7 @@ ...@@ -277,6 +277,7 @@
277 Qlr, 277 Qlr,
278 Qlxz, 278 Qlxz,
279 }, 279 },
280 inject:['reload'],
280 data () { 281 data () {
281 return { 282 return {
282 lx:"zrz", 283 lx:"zrz",
...@@ -484,7 +485,7 @@ ...@@ -484,7 +485,7 @@
484 // this.form.xmmc=this.$store.xmmc; 485 // this.form.xmmc=this.$store.xmmc;
485 this.form.zrzbsm=this.$route.query.bsm; 486 this.form.zrzbsm=this.$route.query.bsm;
486 this.getZddm(this.$store.zdbsm); 487 this.getZddm(this.$store.zdbsm);
487 488 this.getZrzDetailByBsm(this.$route.query.bsm)
488 }else { 489 }else {
489 this.bsm=this.$route.query.bsm; 490 this.bsm=this.$route.query.bsm;
490 this.form.zrzbsm=this.$route.query.bsm; 491 this.form.zrzbsm=this.$route.query.bsm;
...@@ -494,7 +495,17 @@ ...@@ -494,7 +495,17 @@
494 this.getZrzDetailByBsm(this.$route.query.bsm) 495 this.getZrzDetailByBsm(this.$route.query.bsm)
495 } 496 }
496 }, 497 },
497 mounted() {} 498 mounted() {},
499 computed: {
500 zrzbsm() {
501 return this.$store.state.zdbsm;
502 },
503 },
504 watch:{
505 zrzbsm:function (val) {
506 this.reload()
507 }
508 }
498 } 509 }
499 </script> 510 </script>
500 <style rel="stylesheet/less" lang="less" scoped> 511 <style rel="stylesheet/less" lang="less" scoped>
......