Quellcode durchsuchen

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

daxiong.yang vor 7 Jahren
Ursprung
Commit
45d1187ce2
2 geänderte Dateien mit 3 neuen und 12 gelöschten Zeilen
  1. 1 1
      package.json
  2. 2 11
      src/views/layout/sidebar.vue

+ 1 - 1
package.json

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

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

1
<template>
1
<template>
2
  <aside class="site-sidebar">
2
  <aside class="site-sidebar">
3
    <div class="site-sidebar__inner">
3
    <div class="site-sidebar__inner">
4
      <!--  -->
5
      <el-menu
4
      <el-menu
6
        ref="menuNav"
7
        :default-active="menuNavActive"
5
        :default-active="menuNavActive"
8
        :default-openeds="menuNavOpeneds"
9
        :collapse="$store.state.sidebarCollapse"
6
        :collapse="$store.state.sidebarCollapse"
10
        class="site-sidebar__menu"
7
        class="site-sidebar__menu"
11
        background-color="#545c64"
8
        background-color="#545c64"
34
  export default {
31
  export default {
35
    data () {
32
    data () {
36
      return {
33
      return {
37
        menuNavActive: '1-1',
38
        menuNavOpeneds: ['1']
34
        menuNavActive: '1-1'
39
      }
35
      }
40
    },
36
    },
41
    components: {
37
    components: {
42
      SubMenuNav
38
      SubMenuNav
43
    },
39
    },
44
    watch: {
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
    created () {
43
    created () {
53
      this.routeHandle(this.$route, true)
44
      this.routeHandle(this.$route, true)