Explorar el Código

feat: 添加赶回按钮控制

黎海 hace 2 años
padre
commit
e47f1edb38

+ 6 - 1
src/components/common/layout/layout.vue

@@ -2,7 +2,8 @@
2 2
   <div class="layout">
3 3
     <div class="menu-wrapper">
4 4
       <left-menu :isCollapse='isFold'
5
-                 @changeMenu="changeMenu"></left-menu>
5
+                 @changeMenu="changeMenu"
6
+                 @changeIsBack="changeIsBack"></left-menu>
6 7
     </div>
7 8
     <div class="content">
8 9
       <header :style="menuIndex==0?'justify-content: space-between;':''">
@@ -41,6 +42,7 @@
41 42
 import leftMenu from './leftMenu'
42 43
 import api from '@/server/home'
43 44
 
45
+
44 46
 export default {
45 47
   data () {
46 48
     return {
@@ -76,6 +78,9 @@ export default {
76 78
     changeMenu (index) {
77 79
       this.menuIndex = index
78 80
     },
81
+    changeIsBack (isback) {
82
+      this.isback = isback
83
+    },
79 84
     goBack () {
80 85
       this.$router.back()
81 86
     }

+ 2 - 1
src/components/common/layout/leftMenu.vue

@@ -89,7 +89,8 @@ export default {
89 89
   watch: {
90 90
     $route (to, from) {
91 91
       let patname = `/${window.location.hash.split('/')[1]}`
92
-      console.log(patname, 'patname', window.location);
92
+      console.log(patname, 'patname', to);
93
+      this.$emit('changeIsBack', to.meta.isback)
93 94
       this.menu.forEach((item, index) => {
94 95
         if (patname == item.path) {
95 96
           this.nowIndex = index

+ 28 - 4
src/router/map/home.js

@@ -22,14 +22,38 @@ export default {
22 22
   children: [
23 23
     { path: '/home', component: Home },
24 24
     { path: '/testSkin', component: TestSkin },
25
-    { path: '/testSkin/details', component: TestSkinDetails },
25
+    {
26
+      path: '/testSkin/details',
27
+      meta: {
28
+        isback: true,
29
+      },
30
+      component: TestSkinDetails
31
+    },
26 32
     { path: '/customerMan', component: CustomerMan },
27
-    { path: '/customerMan/details', component: CustomerManDetails },
33
+    {
34
+      path: '/customerMan/details',
35
+      meta: {
36
+        isback: true,
37
+      },
38
+      component: CustomerManDetails
39
+    },
28 40
     { path: '/customerMan/projectOrder', component: projectOrder },
29 41
     { path: '/historicalOrder', component: HistoricalOrder },
30
-    { path: '/historicalOrder/details', component: HistoricalOrderDetails },
42
+    {
43
+      path: '/historicalOrder/details',
44
+      meta: {
45
+        isback: true,
46
+      },
47
+      component: HistoricalOrderDetails
48
+    },
31 49
     { path: '/confirmOrder', component: ConfirmOrder },
32
-    { path: '/confirmOrder/details', component: ConfirmOrderDetails },
50
+    {
51
+      path: '/confirmOrder/details',
52
+      meta: {
53
+        isback: true,
54
+      },
55
+      component: ConfirmOrderDetails
56
+    },
33 57
     { path: '/storeDetection', component: StoreDetection },
34 58
     { path: '/coupon', component: Coupon },
35 59