feat: 1. 更新音乐插件 2. 组件注册插件增加单插件模式

This commit is contained in:
539943419 committed 2024-09-27 14:04:41 +08:00
1 parent 4b5b7956c7
commit 38e1b098d2
9 files changed
+316 -41

No files matched your search

+13 -2
View File
@@ -1,9 +1,10 @@
import { reactive, shallowRef } from 'vue'
import { Component, reactive, shallowRef } from 'vue'
import VirtualDirectory, { VirtualFile } from './VirtualDirectory'
import generateId from '@/hooks/generateId'
export interface VirtualPageOption {
exitConfirm?: boolean
allowCopy?: boolean
}
export interface ViewsPushOption {
@@ -44,6 +45,7 @@ export default class VirtualPage {
this.refreshKey = Math.random()
this.color = getRandomWebSafeColor()
this.exitConfirm = initObjects?.option?.exitConfirm ?? false
this.allowCopy = initObjects?.option?.allowCopy ?? true
}
// 页面使用的组件
component: any
@@ -61,8 +63,10 @@ export default class VirtualPage {
color: string
// 用于展示的title
_title?: string
// 关闭时是否需要确认
// 关闭时是否需要确认(未实现)
exitConfirm: boolean
// 是否允许复制页面
allowCopy: boolean
get title() {
if (this._title) {
@@ -155,4 +159,11 @@ export class VirtualPages {
deleteView(index: number) {
this._views.splice(index, 1)
}
/**
* 返回第一个使用此组件的页面
*/
find(component: Component) {
return this._views.find(v=>v.component === component)
}
}