Uncaught TypeError: Cannot read property 'classList' of null
duongphuhiep opened this issue · 6 comments
vue-simple-context-menu.esm.js?2560:60 Uncaught TypeError: Cannot read property 'classList' of null
at VueComponent.hideContextMenu (vue-simple-context-menu.esm.js?2560:60)
at VueComponent.onClickOutside (vue-simple-context-menu.esm.js?2560:63)
at eval (v-click-outside.min.js?81a8:1)
at Array.forEach ()
at HTMLDocument.n.onEvent (v-click-outside.min.js?81a8:1)
happen when use it inside vue-router keep-alive
<keep-alive>
<router-view />
</keep-alive>
Hey there - can I see your usage of the plugin? You're setting the required id
string prop correct?
yes I set the required id = "tabsContextMenu"
<!--Tab context menu-->
<VueSimpleContextMenu
id="tabsContextMenu"
ref="tabsContextMenu"
:options="contextMenuItems"
@optionClicked="runContextMenuAction" />
it happens when vue-router
navigate to other page which don't (no longer) have this element on the real DOM.
but the event onClickOutside (of the old page) is still effective because the old page is cached with keep-alive
.
it appears that this case isn't handle
Ok got it - sorry you're having problems. I will be looking into this and will have a fix in a few days.
Ok so I just put out v2.0.1 - I made sure to check for the existence of the element before checking the classList
- let me know if that still gives you any issues. Thank you.
I confirm that the bug is fixed! keep up the good work. thank you