v-contextmenu
v-contextmenu copied to clipboard
Contextmenu mounted 钩子 this.$contextmenuId这个时候是不是undefined的哈
@snokier 看到 Contextmenu mounted 的代码的时候 有一点不明白 这里 this.$contextmenuId 应该都是undefined的吧 我看contextmenuId 都是在 指令 inserted的时候才赋值的 。
mounted () {
const elm = document.querySelector(this.containerSelector)
elm.appendChild(this.$el)
if (window.$$VContextmenu) {
window.$$VContextmenu[this.$contextmenuId] = this
} else {
window.$$VContextmenu = { [this.$contextmenuId]: this }
}
},
你说的很对,想必这是个 bug 了
https://github.com/snokier/v-contextmenu/blob/master/src/components/Contextmenu.vue#L78 https://github.com/snokier/v-contextmenu/blob/master/src/directive.js#L4
^_^ 希望作者可以尽快修复 我好可以基于您这个组件写一个自己的小东西