Skip to content

Commit 72798c2

Browse files
author
张柯雨
committed
[feature] 修复router参数问题
1 parent 0fa18f2 commit 72798c2

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

example/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<privilege-menu
44
:routerMap="routerMap"
55
:role="role"
6+
router
67
@select="handleSelect"
78
@open="handleOpen"
89
@close="handleClose"/>

lib/privilegeMenu.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ export default {
5757
},
5858
methods: {
5959
menuGenerate() {
60-
if(this.router){
61-
let realRoutes = routesGenerate(this.routerMap, this.role)
62-
this.$router.addRoutes(realRoutes)
63-
this.$router.options.routes = this.$router.options.routes ?
64-
this.$router.options.routes.concat(realRoutes) :
65-
realRoutes
66-
}
60+
let realRoutes = routesGenerate(this.routerMap, this.role)
61+
this.$router.addRoutes(realRoutes)
62+
this.$router.options.routes = this.$router.options.routes ?
63+
this.$router.options.routes.concat(realRoutes) :
64+
realRoutes
6765
this.siders = sideMenuGenerate(this.routerMap, this.role)
6866
}
6967
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-privilege-menu",
33
"description": "Automatically generate routes and menu by given privilege",
4-
"version": "1.0.13",
4+
"version": "1.1.1",
55
"author": "zhangkeyu",
66
"license": "MIT",
77
"private": false,

0 commit comments

Comments
 (0)