From 0b27a30887ee4fc54916d5eae43f074ebf7d408c Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Sun, 7 Apr 2019 11:35:04 +0800 Subject: [PATCH] fixed #165 Former-commit-id: bb4aa89bb54e590d51b5fdfef8f8ecbd320d3ab8 [formerly bb4aa89bb54e590d51b5fdfef8f8ecbd320d3ab8 [formerly bb4aa89bb54e590d51b5fdfef8f8ecbd320d3ab8 [formerly bb4aa89bb54e590d51b5fdfef8f8ecbd320d3ab8 [formerly 76a9815bbfe46656c04507e2343db7c913d327ac [formerly f368e3d9f9f6df2e27dbcf59d9faa425a2192ecb]]]]] Former-commit-id: 92af69f0a2a4d5b55429b26ce074013893734467 Former-commit-id: 75ed4fa7b2594e8e927a15206a089db25ec16aa2 Former-commit-id: 736b169460b87c95893b9ba3b2c9e2c6cdf0dae0 [formerly 02288701a7281bafdd8307e8046c9ea24eeb56c8] Former-commit-id: 1458a84d001be98a5a7546db37717e7fcf787fb5 Former-commit-id: fab4c59663b1d2ad132b609d2b30db716ae13456 Former-commit-id: 55ca9bc56473c7666d95227cc1a21b70e3bd8071 Former-commit-id: a4e1b98abf2276e7651cbe6e5d89801323307d5e Former-commit-id: c1b8d27f20e627632328407a1e7c21491252fc56 --- src/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.js b/src/main.js index bfc59bac..9e95a552 100644 --- a/src/main.js +++ b/src/main.js @@ -74,10 +74,13 @@ new Vue({ this.$store.dispatch('d2admin/fullscreen/listen') }, watch: { - // 监听路由 控制侧边栏显示 - '$route.matched' (val) { - const _side = menuAside.filter(menu => menu.path === val[0].path) - this.$store.commit('d2admin/menu/asideSet', _side.length > 0 ? _side[0].children : []) + // 检测路由变化切换侧边栏内容 + '$route.matched': { + handler (value) { + const _side = menuAside.filter(menu => menu.path === value[0].path) + this.$store.commit('d2admin/menu/asideSet', _side.length > 0 ? _side[0].children : []) + }, + immediate: true } } }).$mount('#app')