Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

菜单显示时不能隐藏别的菜单 #59

Closed
zengwenfu opened this issue May 9, 2019 · 2 comments
Closed

菜单显示时不能隐藏别的菜单 #59

zengwenfu opened this issue May 9, 2019 · 2 comments

Comments

@zengwenfu
Copy link

期望结果

list 中每个 item 都注册了 menu,右键某一条菜单出来的时候,隐藏掉其它的菜单

实际结果

list 中每个 item 都注册了 menu,右键某一条菜单出来的时候,其它菜单没有隐藏掉

复现步骤

删除
@zengwenfu
Copy link
Author

visible (value) {
const elm = document.querySelector(this.containerSelector)

  if (value) {
    this.$emit('show', this)

    elm.addEventListener('click', this.handleBodyClick)
  } else {
    this.$emit('hide', this)

    elm.removeEventListener('click', this.handleBodyClick)
  }
}

click 改为 mousedown 就可以了

@zengwenfu
Copy link
Author

`/* eslint-disable no-param-reassign */
export default {
// 之所以用 inserted 而不是 bind,是需要确保 contentmenu mounted 后才进行 addRef 操作
inserted (el, binding, vnode) {
const contextmenu = vnode.context.$refs[binding.arg]

contextmenu.addRef({ el, vnode })
contextmenu.$contextmenuId = el.id || contextmenu._uid // eslint-disable-line no-underscore-dangle

}
}`
这里id注入有可能有问题的会,menu的渲染先于此注入,showAll 那个注册就是 undefined
给contextMenu 传入一个key 嘛~~

@CyberNika CyberNika mentioned this issue Sep 25, 2019
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants