Parcourir la Source

升级element-ui,修复菜单展开收缩bug!

daxiong.yang 7 ans auparavant
Parent
commit
45d1187ce2
2 fichiers modifiés avec 3 ajouts et 12 suppressions
  1. 1 1
      package.json
  2. 2 11
      src/views/layout/sidebar.vue

+ 1 - 1
package.json

@ -20,7 +20,7 @@
20 20
    "babel-plugin-syntax-jsx": "^6.18.0",
21 21
    "babel-plugin-transform-vue-jsx": "^3.5.1",
22 22
    "babel-polyfill": "6.26.0",
23
    "element-ui": "2.0.7",
23
    "element-ui": "2.1.0",
24 24
    "vue": "2.5.2",
25 25
    "vue-cookie": "1.1.4",
26 26
    "vue-router": "3.0.1",

+ 2 - 11
src/views/layout/sidebar.vue

@ -1,11 +1,8 @@
1 1
<template>
2 2
  <aside class="site-sidebar">
3 3
    <div class="site-sidebar__inner">
4
      <!--  -->
5 4
      <el-menu
6
        ref="menuNav"
7 5
        :default-active="menuNavActive"
8
        :default-openeds="menuNavOpeneds"
9 6
        :collapse="$store.state.sidebarCollapse"
10 7
        class="site-sidebar__menu"
11 8
        background-color="#545c64"
@ -34,20 +31,14 @@
34 31
  export default {
35 32
    data () {
36 33
      return {
37
        menuNavActive: '1-1',
38
        menuNavOpeneds: ['1']
34
        menuNavActive: '1-1'
39 35
      }
40 36
    },
41 37
    components: {
42 38
      SubMenuNav
43 39
    },
44 40
    watch: {
45
      $route: 'routeHandle',
46
      '$store.state.sidebarCollapse': function (val) {
47
        if (!val) {
48
          this.$refs.menuNav.open(this.menuNavOpeneds[0])
49
        }
50
      }
41
      $route: 'routeHandle'
51 42
    },
52 43
    created () {
53 44
      this.routeHandle(this.$route, true)