mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19:19 +08:00
feat: 优化缩小化
This commit is contained in:
@@ -27,6 +27,13 @@ function ensureShadow(host: HTMLElement): ShadowRoot {
|
||||
return host.shadowRoot ?? host.attachShadow({ mode: 'open' });
|
||||
}
|
||||
|
||||
function setHostHidden(hidden: boolean) {
|
||||
const host = document.getElementById(HOST_ID);
|
||||
if (host) {
|
||||
host.style.display = hidden ? 'none' : '';
|
||||
}
|
||||
}
|
||||
|
||||
function removeLauncher() {
|
||||
document.getElementById(LAUNCHER_ID)?.remove();
|
||||
}
|
||||
@@ -70,12 +77,16 @@ function unmountApp() {
|
||||
if (host?.shadowRoot) {
|
||||
host.shadowRoot.innerHTML = '';
|
||||
}
|
||||
if (host) {
|
||||
host.style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function mountApp() {
|
||||
const host = ensureHost();
|
||||
const shadow = ensureShadow(host);
|
||||
shadow.innerHTML = '';
|
||||
host.style.display = '';
|
||||
|
||||
const styleEl = document.createElement('style');
|
||||
styleEl.textContent = styles;
|
||||
@@ -87,8 +98,9 @@ function mountApp() {
|
||||
app = createApp(FloatingPanel, {
|
||||
onClose: () => setFloatingVisible(false),
|
||||
onMinimize: () => {
|
||||
// 只隐藏,不销毁 Vue,保留已累计的多日数据
|
||||
minimized = true;
|
||||
unmountApp();
|
||||
setHostHidden(true);
|
||||
showLauncher();
|
||||
visible = true;
|
||||
emitFeatureEvent(FEATURE_ID, 'minimized');
|
||||
@@ -115,10 +127,9 @@ export function setFloatingVisible(next: boolean): boolean {
|
||||
}
|
||||
|
||||
visible = true;
|
||||
minimized = false;
|
||||
removeLauncher();
|
||||
if (minimized) {
|
||||
minimized = false;
|
||||
}
|
||||
setHostHidden(false);
|
||||
if (!app) {
|
||||
mountApp();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"updatedAt": "2026-08-16T12:42:11.994Z",
|
||||
"updatedAt": "2026-08-16T12:53:27.630Z",
|
||||
"features": [
|
||||
{
|
||||
"id": "pdd-ad-fee",
|
||||
@@ -12,7 +12,7 @@
|
||||
"https://yingxiao.pinduoduo.com/"
|
||||
],
|
||||
"entry": "pdd-ad-fee.js",
|
||||
"sha256": "6bd6e3ac7ca697fe9f6dd67b1cf17013959981c6e7cae8d95d175c95325071ed",
|
||||
"sha256": "da5e94dde412aff60347b39e73a321be517b55ba5e801f44432070fdce439c4b",
|
||||
"executionWorld": "main"
|
||||
}
|
||||
]
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user