Browse Source

fix: account submenu select #276

Sendya 5 years ago
parent
commit
521b64548c
2 changed files with 8 additions and 4 deletions
  1. 8 3
      src/views/account/settings/Index.vue
  2. 0 1
      vue.config.js

+ 8 - 3
src/views/account/settings/Index.vue

@@ -6,7 +6,7 @@
           <a-menu
             :mode="device == 'mobile' ? 'horizontal' : 'inline'"
             :style="{ border: '0', width: device == 'mobile' ? '560px' : 'auto'}"
-            :defaultSelectedKeys="defaultSelectedKeys"
+            :selectedKeys="selectedKeys"
             type="inner"
             @openChange="onOpenChange"
           >
@@ -64,7 +64,7 @@ export default {
       mode: 'inline',
 
       openKeys: [],
-      defaultSelectedKeys: [],
+      selectedKeys: [],
 
       // cropper
       preview: {},
@@ -96,7 +96,12 @@ export default {
     },
     updateMenu () {
       const routes = this.$route.matched.concat()
-      this.defaultSelectedKeys = [ routes.pop().path ]
+      this.selectedKeys = [ routes.pop().path ]
+    }
+  },
+  watch: {
+    '$route' (val) {
+      this.updateMenu()
     }
   }
 }

+ 0 - 1
vue.config.js

@@ -33,7 +33,6 @@ module.exports = {
         matchColors: getAntdSerials('#1890ff'), // 主色系列
         // 改变样式选择器,解决样式覆盖问题
         changeSelector (selector) {
-          console.log(selector)
           switch (selector) {
             case '.ant-calendar-today .ant-calendar-date':
               return ':not(.ant-calendar-selected-date)' + selector