import { Module } from 'vuex' ; import { RootState } from '@/store' ; import ContextMenu from '@/components/context-menu/context-menu' ; interface ContextMenuState { mount : Element ; } const initialState = { mount : document . createElement ( 'div' ) } ; const mutations = { setMount ( state , mount ) { state . mount = mount ; } , mount ( state , menu ) { if ( ! menu ) { console . error ( 'attempted to mount undefined context menu' ) ; return ; } state . mount . appendChild ( menu . $el ) ; } } ; const contextMenu = { namespaced : true , state : initialState , mutations } ; export default contextMenu ;