23 lines
724 B
JavaScript
23 lines
724 B
JavaScript
import Vue from "vue";
|
|
import Video from "./index.vue";
|
|
|
|
const PreviewConstructor = Vue.extend(Video);
|
|
|
|
const video = options => {
|
|
const { path, type, title } = options;
|
|
if (!path) throw `path is requred.but ${path}`
|
|
const id = `OnlyOffice_${new Date().getTime()}`;
|
|
const instance = new PreviewConstructor();
|
|
instance.id = id;
|
|
instance.vm = instance.$mount();
|
|
if (instance.vm.visible) return;
|
|
document.body.appendChild(instance.vm.$el);
|
|
instance.vm.open(path, type, title);
|
|
instance.vm.$on("closed", () => {
|
|
instance.vm.docEditor = null
|
|
document.body.removeChild(instance.vm.$el);
|
|
instance.vm.$destroy();
|
|
});
|
|
return instance.vm;
|
|
}
|
|
export default video; |