Skip to content

Commit

Permalink
menu:增加submenu-click、submenu-enter事件
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri authored and yuri committed Mar 5, 2018
1 parent aeb530d commit b627a68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/docs/zh-cn/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ export default {

| 事件 | 说明 | 参数 |
|---------- |-------------- |---------- |-------- |
| submenu-click | 点击subMenu title时触发 | 被点击的submenu的数据 |
| submenu-enter | 鼠标移入subMenu title时触发 | 鼠标移入的submenu的数据 |
| item-click | 点击Menu Item时触发 | 从根到叶的数组,包含路径上的每个节点的数据 |

### Menu:Data Prop
Expand Down
2 changes: 2 additions & 0 deletions vb/components/menu/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ export default {
},
clickTriggerOpen(disabled, index) {
if (!disabled && this.innerMode === 'inline') {
this.$emit('submenu-click', this.data[index]);
this.setOpen(index, !this.data[index].expand);
}
},
mouseTriggerOpen(disabled, index, status) {
if (!disabled && this.innerMode !== 'inline') {
this.$emit('submenu-enter', this.data[index]);
if (this.timer[index]) clearTimeout(this.timer[index]);
this.timer[index] = setTimeout(() => this.setOpen(index, status), 300);
}
Expand Down

0 comments on commit b627a68

Please # to comment.