iceshrimp/src/client/app/desktop/api/contextmenu.ts

17 lines
357 B
TypeScript
Raw Normal View History

2018-02-18 12:35:18 +09:00
import Ctx from '../views/components/context-menu.vue';
export default function(e, menu, opts?) {
const o = opts || {};
const vm = new Ctx({
propsData: {
menu,
x: e.pageX - window.pageXOffset,
y: e.pageY - window.pageYOffset,
}
}).$mount();
vm.$once('closed', () => {
if (o.closed) o.closed();
});
document.body.appendChild(vm.$el);
}