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 | — | — | | index | 唯一标志 | string | — | — |
| route | Vue Router 路径对象 | Object | — | — |
### Menu-Group Attribute ### Menu-Group Attribute
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

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

View File

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