mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
27 lines
571 B
TypeScript
27 lines
571 B
TypeScript
import { mountVueComponent } from '@/core/utils'
|
|
|
|
let panelVm: Vue & {
|
|
toggleDisplay: () => void
|
|
}
|
|
|
|
const getPanelLoadState = () => {
|
|
return Boolean(panelVm)
|
|
}
|
|
|
|
const mountPanel = async () => {
|
|
const panel = await import('./Panel1.vue').then(m => m.default)
|
|
panelVm = mountVueComponent(panel)
|
|
document.body.insertAdjacentElement('beforeend', panelVm.$el)
|
|
}
|
|
|
|
export const loadPanel = async () => {
|
|
const isLoaded = getPanelLoadState()
|
|
if (!isLoaded) {
|
|
await mountPanel()
|
|
}
|
|
}
|
|
|
|
export const togglePanelDisplay = async () => {
|
|
panelVm.toggleDisplay()
|
|
}
|