Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37791ab04e | ||
|
|
e155524e3e |
No files matched your search
@@ -20,6 +20,7 @@ export interface registerComponentOption {
|
|||||||
exitConfirm?: boolean;
|
exitConfirm?: boolean;
|
||||||
// 若为true,则只会创建一个页面,当存在已创建页面则会直接将VFile和VDir加到curr里面
|
// 若为true,则只会创建一个页面,当存在已创建页面则会直接将VFile和VDir加到curr里面
|
||||||
single?: boolean;
|
single?: boolean;
|
||||||
|
priority?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Plugin = {
|
export type Plugin = {
|
||||||
@@ -31,6 +32,8 @@ export type Plugin = {
|
|||||||
disable: boolean;
|
disable: boolean;
|
||||||
// 插件所属的group,用于区分插件使用的场合
|
// 插件所属的group,用于区分插件使用的场合
|
||||||
group: PluginGroup[];
|
group: PluginGroup[];
|
||||||
|
// 插件优先级
|
||||||
|
priority: number;
|
||||||
// 判断在未禁用时是否可以使用这个组件
|
// 判断在未禁用时是否可以使用这个组件
|
||||||
// 使用组件即调用下面的func
|
// 使用组件即调用下面的func
|
||||||
filter: (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => boolean;
|
filter: (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => boolean;
|
||||||
@@ -56,7 +59,7 @@ export default class PluginCenter {
|
|||||||
* 便捷地注册一个组件为插件,触发时直接用新页面打开
|
* 便捷地注册一个组件为插件,触发时直接用新页面打开
|
||||||
*/
|
*/
|
||||||
registerComponent(option: registerComponentOption): void {
|
registerComponent(option: registerComponentOption): void {
|
||||||
const { key, name, getComponent, icon, filter, group = [PluginGroup.default], disable = false, exitConfirm = false, single = false } = option;
|
const { key, name, getComponent, icon, filter, group = [PluginGroup.default], disable = false, exitConfirm = false, single = false, priority = 0 } = option;
|
||||||
let _component: any;
|
let _component: any;
|
||||||
const views = useVirtualPages();
|
const views = useVirtualPages();
|
||||||
this.register(key, {
|
this.register(key, {
|
||||||
@@ -65,6 +68,7 @@ export default class PluginCenter {
|
|||||||
icon: shallowRef(icon),
|
icon: shallowRef(icon),
|
||||||
group,
|
group,
|
||||||
disable,
|
disable,
|
||||||
|
priority,
|
||||||
func: async (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => {
|
func: async (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => {
|
||||||
if (filter(VDirectories, VFiles) === false) {
|
if (filter(VDirectories, VFiles) === false) {
|
||||||
return;
|
return;
|
||||||
@@ -110,10 +114,12 @@ export default class PluginCenter {
|
|||||||
usableList.push(key);
|
usableList.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return usableList.map(key => ({
|
const res = usableList.map(key => ({
|
||||||
key,
|
key,
|
||||||
...this.pluginsMap[key]
|
...this.pluginsMap[key]
|
||||||
}));
|
}))
|
||||||
|
res.sort((a, b) => b.priority - a.priority);
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
usePlugin(key: string, VDirectories?: VirtualDirectory[], VFiles?: VirtualFile[], ...args: any[]) {
|
usePlugin(key: string, VDirectories?: VirtualDirectory[], VFiles?: VirtualFile[], ...args: any[]) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!-- 只适合用于渲染过程较为复杂的组件,不然可能得不偿失
|
<!-- 只适合用于渲染过程较为复杂的组件,不然可能得不偿失
|
||||||
这么泛用的组件,性能差点也能理解 -->
|
这么泛用的组件,性能差点也能理解 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="miao-lazy" ref="miaoLazyRoot" :style="!show ? { minHeight, minWidth } : {}">
|
<div class="miao-lazy" ref="miaoLazyRoot" :style="!show ? { minHeight, minWidth, margin } : {}">
|
||||||
<slot v-if="show" />
|
<slot v-if="show" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,6 +22,10 @@ const props = defineProps({
|
|||||||
minWidth: {
|
minWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'none',
|
default: 'none',
|
||||||
|
},
|
||||||
|
margin: {
|
||||||
|
type: String,
|
||||||
|
default: 'none',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ onBeforeUnmount(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
|
overflow-x: hidden;
|
||||||
.item-main-front {
|
.item-main-front {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
<miao-lazy-div
|
<miao-lazy-div
|
||||||
v-for="dir in showData_directory"
|
v-for="dir in showData_directory"
|
||||||
:key="dir.id"
|
:key="dir.id"
|
||||||
min-height="50px">
|
min-height="50px"
|
||||||
|
margin="10px">
|
||||||
<miaoDirectoryItem
|
<miaoDirectoryItem
|
||||||
:item="dir"
|
:item="dir"
|
||||||
:color="props.color"
|
:color="props.color"
|
||||||
|
|||||||
@@ -376,7 +376,12 @@ const handleItemClick = (item: VirtualDirectory | VirtualFile) => {
|
|||||||
handleItemSelect(item)
|
handleItemSelect(item)
|
||||||
} else {
|
} else {
|
||||||
if (item.type === 'file') {
|
if (item.type === 'file') {
|
||||||
|
const useablePlugins = pluginCenter.getUsablePlugin([], [item])
|
||||||
|
if(useablePlugins.length > 0){
|
||||||
|
pluginCenter.usePlugin(useablePlugins[0].key, [], [item])
|
||||||
|
} else {
|
||||||
openUrl(`${baseUrl}${api.get}${item.path}`)
|
openUrl(`${baseUrl}${api.get}${item.path}`)
|
||||||
|
}
|
||||||
} else if (item.type === 'directory') {
|
} else if (item.type === 'directory') {
|
||||||
setCurrentDirectory(item)
|
setCurrentDirectory(item)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ const pluginConfig: registerComponentOption = {
|
|||||||
return vFiles[0].name.endsWith('?')
|
return vFiles[0].name.endsWith('?')
|
||||||
},
|
},
|
||||||
disable: false,
|
disable: false,
|
||||||
single: true
|
single: true,
|
||||||
|
priority: 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default pluginConfig
|
export default pluginConfig
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<span class="aplayer-list-title">{{ element.name }}</span>
|
<span class="aplayer-list-title">{{ element.name }}</span>
|
||||||
<div class="aplayer-list-control">
|
<div class="aplayer-list-control">
|
||||||
<div class="aplayer-list-control-btn aplayer-list-control-btn-hover aplayer-list-control-btn-play"
|
<div class="aplayer-list-control-btn aplayer-list-control-btn-hover aplayer-list-control-btn-play"
|
||||||
@click.stop="switchAudio(index)" v-if="activeAudioIndex !== index">
|
@click.stop="switchAudio(index)">
|
||||||
<PlayOutline class="aplayer-list-control-btn-svg" />
|
<PlayOutline class="aplayer-list-control-btn-svg" />
|
||||||
</div>
|
</div>
|
||||||
<div class="aplayer-list-control-btn aplayer-list-control-btn-hover"
|
<div class="aplayer-list-control-btn aplayer-list-control-btn-hover"
|
||||||
@@ -151,6 +151,7 @@ onMounted(() => {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
margin-right: 4px !important;
|
margin-right: 4px !important;
|
||||||
|
cursor: default !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
.aplayer svg circle,
|
.aplayer svg circle,
|
||||||
.aplayer .aplayer-list-new svg path {
|
.aplayer .aplayer-list-new svg path {
|
||||||
fill: #ffffff00;
|
fill: #ffffff00;
|
||||||
@@ -195,4 +196,14 @@ onMounted(() => {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
background: #60e8a2 !important;
|
background: #60e8a2 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aplayer-list-light {
|
||||||
|
background: unset !important;
|
||||||
|
.aplayer-list-title {
|
||||||
|
color: #60e8a2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.aplayer .aplayer-list ol li:hover {
|
||||||
|
background: #efefef !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user