mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
36 lines
747 B
JavaScript
36 lines
747 B
JavaScript
import { createApp } from 'vue';
|
|
import App from './App.vue';
|
|
|
|
export default class Control {
|
|
constructor(art, danmuku) {
|
|
this.art = art;
|
|
this.danmuku = danmuku;
|
|
this.apps = new Map();
|
|
}
|
|
|
|
mount($el) {
|
|
const that = this;
|
|
const app = createApp(App);
|
|
|
|
app.use({
|
|
install(app) {
|
|
app.config.globalProperties.$art = that.art;
|
|
app.config.globalProperties.$danmuku = that.danmuku;
|
|
},
|
|
});
|
|
|
|
app.mount($el);
|
|
this.apps.set($el, app);
|
|
|
|
return app;
|
|
}
|
|
|
|
unmount($el) {
|
|
const app = this.apps.get($el);
|
|
if (app) {
|
|
app.unmount();
|
|
this.apps.delete($el);
|
|
}
|
|
}
|
|
}
|