Skip to content

Commit

Permalink
fix #38
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoren1641 committed Dec 3, 2017
1 parent b7556f8 commit e65cfad
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
12 changes: 6 additions & 6 deletions dist/atui.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/components/Menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export default {
}
},
openOne: Boolean,
selectedKey: String
defaultSelectedKey: String
},
data () {
return {
selectedKey: this.defaultSelectedKey
}
},
components: {
vSubMenu,
Expand All @@ -44,11 +49,12 @@ export default {
},
mounted () {
let me = this
if (me.selectedKey) {
if (me.defaultSelectedKey) {
me.$bus.$emit('Menu-searchItem', me.selectedKey)
}
me.$bus.$on('Menu-itemClicked', (item, uuid) => {
me.$bus.$emit('Menu-searchItem', uuid)
me.selectedKey = uuid
me.$emit('click', item, uuid)
})
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Menu/MenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export default {
this.$bus.$on('Menu-searchItem', (uuid) => {
this.selectedStatus = this.uuid === uuid
if (this.selectedStatus) {
this.$bus.$emit('Menu-open', this, this.uuid)
// this.$bus.$emit('Menu-open', this, this.uuid)
console.log(this.$parent.$parent)
this.$parent.$parent.open = true
}
})
}
Expand Down
11 changes: 5 additions & 6 deletions src/components/Menu/SubMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export default {
},
mounted () {
this.$forceUpdate()
// let me = this
// me.$bus.$on('Menu-open', (item, uuid) => {
// console.log(me.$children)
// // me.open = true
// })
},
watch: {
open (val) {
Expand All @@ -79,12 +84,6 @@ export default {
this.open = !this.open
}
},
events: {
// 当子menu选中时,自动打开父菜单
open () {
this.open = true
}
},
transitions: {
collapse: {
afterEnter (el) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ title:


````jsx
<v-menu @click.native="click">
<v-menu @click.native="click" default-selected-key="2">
<v-sub-menu uuid="sub1" title="导航一">
<v-menu-item-group title="分组1">
<v-menu-item uuid="1">选项1</v-menu-item>
Expand Down

0 comments on commit e65cfad

Please sign in to comment.