feat: 添加主页插件支持
This commit is contained in:
1 parent
1f42785b4a
commit
90a068939d
11 files changed
+184
-82
No files matched your search
@@ -25,3 +25,5 @@ const pluginConfig: Plugin = {
|
||||
export default pluginConfig;
|
||||
|
||||
export const type = PluginExportType.default;
|
||||
|
||||
export const key = 'miaoCopy';
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Plugin, PluginGroup } from "@/class/PluginCenter";
|
||||
import fullScreen from "./fullScreen";
|
||||
import { ExpandOutline } from "@vicons/ionicons5";
|
||||
import { PluginExportType } from "@/types/type";
|
||||
import { shallowRef } from "vue";
|
||||
|
||||
const pluginConfig: Plugin = {
|
||||
name: "全屏",
|
||||
icon: shallowRef(ExpandOutline),
|
||||
filter: () => {
|
||||
return true;
|
||||
},
|
||||
disable: false,
|
||||
group: [PluginGroup.mainMenu],
|
||||
func: fullScreen,
|
||||
priority: -1
|
||||
};
|
||||
|
||||
export default pluginConfig;
|
||||
|
||||
export const type = PluginExportType.default;
|
||||
|
||||
export const key = "fullScreen";
|
||||
@@ -0,0 +1,4 @@
|
||||
const fullScreen = () => {
|
||||
document.body.requestFullscreen()
|
||||
}
|
||||
export default fullScreen
|
||||
@@ -1,35 +1,36 @@
|
||||
import { registerComponentOption } from '@/class/PluginCenter'
|
||||
import { PluginExportType } from '@/types/type'
|
||||
import Disc from '@vicons/ionicons5/es/Disc'
|
||||
|
||||
import { registerComponentOption } from "@/class/PluginCenter";
|
||||
import { PluginExportType } from "@/types/type";
|
||||
import Disc from "@vicons/ionicons5/es/Disc";
|
||||
|
||||
const pluginConfig: registerComponentOption = {
|
||||
key: 'miaoMusicPlayer',
|
||||
name: '音乐',
|
||||
icon: Disc,
|
||||
getComponent: async () =>
|
||||
(await import('./miaoMusicPlayer.vue')).default,
|
||||
filter: (vDirs, vFiles) => {
|
||||
if (vDirs.length !== 0) {
|
||||
return false
|
||||
}
|
||||
if (vFiles.length === 0) {
|
||||
return false
|
||||
}
|
||||
for (let i of vFiles) {
|
||||
for (let s of ['mp3', 'flac', 'ogg', 'mp4']) {
|
||||
if (i.name.endsWith(s)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
disable: false,
|
||||
single: true,
|
||||
priority: 5,
|
||||
}
|
||||
key: "miaoMusicPlayer",
|
||||
name: "音乐",
|
||||
icon: Disc,
|
||||
getComponent: async () => (await import("./miaoMusicPlayer.vue")).default,
|
||||
filter: (vDirs, vFiles) => {
|
||||
if (vDirs.length === 0 && vFiles.length === 0) {
|
||||
return true;
|
||||
}
|
||||
if (vDirs.length !== 0) {
|
||||
return false;
|
||||
}
|
||||
if (vFiles.length === 0) {
|
||||
return false;
|
||||
}
|
||||
for (let i of vFiles) {
|
||||
for (let s of ["mp3", "flac", "ogg", "mp4"]) {
|
||||
if (i.name.endsWith(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
disable: false,
|
||||
single: true,
|
||||
priority: 5
|
||||
};
|
||||
|
||||
export default pluginConfig
|
||||
export default pluginConfig;
|
||||
|
||||
export const type = PluginExportType.component
|
||||
export const type = PluginExportType.component;
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Plugin, PluginGroup } from "@/class/PluginCenter";
|
||||
import { PluginExportType } from "@/types/type";
|
||||
import { shallowRef } from "vue";
|
||||
import Disc from "@vicons/ionicons5/es/Disc";
|
||||
|
||||
const pluginConfig: Plugin = {
|
||||
name: "音乐",
|
||||
icon: shallowRef(Disc),
|
||||
filter: (_, __, views) => {
|
||||
return views.find("miaoMusicPlayer").length === 0;
|
||||
},
|
||||
disable: false,
|
||||
group: [PluginGroup.mainMenu],
|
||||
func(_, __, hooks) {
|
||||
const { getPluginCenter } = hooks;
|
||||
const PluginCenter = getPluginCenter();
|
||||
PluginCenter.usePlugin("miaoMusicPlayer", [], []);
|
||||
},
|
||||
priority: -1
|
||||
};
|
||||
|
||||
export default pluginConfig;
|
||||
|
||||
export const type = PluginExportType.default;
|
||||
|
||||
export const key = "musicPlayer-mainMenu";
|
||||
Reference in new issue
Block a user