add menu item route property

pull/196/head
Dean Shi 2016-09-29 11:18:40 -07:00
parent f1e742ab23
commit 2bfb1a870f
No known key found for this signature in database
GPG Key ID: A0CE781125EFD481
3 changed files with 8 additions and 3 deletions

View File

@ -172,6 +172,7 @@
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------- |---------- |------------- |-------- |
| index | 唯一标志 | string | — | — |
| route | Vue Router 路径对象 | Object | — | — |
### Menu-Group Attribute
| 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

@ -12,6 +12,10 @@
type: String,
required: true
},
route: {
type: Object,
required: false
},
disabled: {
type: Boolean,
required: false
@ -24,7 +28,7 @@
},
methods: {
handleClick() {
this.rootMenu.handleSelect(this.index, this.indexPath);
this.rootMenu.handleSelect(this.index, this.indexPath, this.route);
}
},
created() {

View File

@ -84,7 +84,7 @@
this.$emit('open', index, indexPath);
}
},
handleSelect(index, indexPath) {
handleSelect(index, indexPath, route) {
this.activeIndex = index;
this.$emit('select', index, indexPath);
@ -100,7 +100,7 @@
}
if (this.router) {
this.$router.push(index);
this.$router.push(route || index);
}
}
},