feat: 优化插件导入逻辑,视频插件在移动端进入锁定状态时隐藏上下梯度渐变以防止遮挡视频

This commit is contained in:
539943419 committed 2024-12-16 20:00:40 +08:00
1 parent bfc841fac2
commit 8f8d098faa
4 files changed
+11 -10

No files matched your search

+1 -1
View File
@@ -176,7 +176,7 @@ export class VirtualPages {
find(name: string) : VirtualPage[] find(name: string) : VirtualPage[]
find(input: unknown) { find(input: unknown) {
console.log(this) // console.log(this)
if (typeof input === 'string') { if (typeof input === 'string') {
return this._views.filter(v => v.component.name === input); return this._views.filter(v => v.component.name === input);
} else { } else {
+6 -8
View File
@@ -4,24 +4,22 @@ import { alertTipType, PluginExportType } from "@/types/type";
const initPlugin = async (globalAlertTip: alertTipType) => { const initPlugin = async (globalAlertTip: alertTipType) => {
initPluginCenter(globalAlertTip); initPluginCenter(globalAlertTip);
const modulesFiles = import.meta.glob("@/plugins/**/export.ts"); const modulesFiles = import.meta.glob("@/plugins/**/export.ts", { eager: true });
const pluginCenter = usePluginCenter(); const pluginCenter = usePluginCenter();
const promiseArray = []; const promiseArray = [];
for (let pluginConfig of Object.values(modulesFiles)) { for (let pluginConfig of Object.values(modulesFiles)) {
promiseArray.push( promiseArray.push(
new Promise(async resolve => { new Promise(async resolve => {
const _config = pluginConfig as () => Promise<{ const _config = pluginConfig as {
default: registerComponentOption | Plugin; default: registerComponentOption | Plugin;
type: PluginExportType; type: PluginExportType;
key?: string; key?: string;
}>; };
const { type, key } = await _config(); const { type, key } = _config;
if (type === PluginExportType.component) { if (type === PluginExportType.component) {
// @ts-ignore resolve(pluginCenter.registerComponent(_config.default as registerComponentOption));
resolve(pluginCenter.registerComponent((await _config()).default));
} else if (type === PluginExportType.default) { } else if (type === PluginExportType.default) {
// @ts-ignore resolve(pluginCenter.register(key as string, _config.default as Plugin));
resolve(pluginCenter.register(key as string, (await _config()).default));
} }
}) })
); );
+1 -1
View File
@@ -15,7 +15,7 @@ const pluginConfig: registerComponentOption = {
return false return false
} }
for (let i of vFiles) { for (let i of vFiles) {
for (let s of ['mp4']) { for (let s of ['mp4', 'mkv']) {
if (i.name.endsWith(s)) { if (i.name.endsWith(s)) {
return true return true
} }
@@ -1194,6 +1194,9 @@
.xgplayer-mobile.xgplayer-inactive .gradient { .xgplayer-mobile.xgplayer-inactive .gradient {
background-image: initial; background-image: initial;
} }
.xgplayer-locked .gradient {
background-image: initial;
}
.xgplayer-mobile .xgmask { .xgplayer-mobile .xgmask {
position: absolute; position: absolute;
height: 100%; height: 100%;