0277d51ed3
根因:桌面端实际运行在 MainLayout(/console 路径),无 OS 桌面窗口系统,
openApp 打开的 core.web-view 窗口无处渲染 → 外链点击无反应。
- 新增 webViewStore:MainLayout/浏览器模式以全屏覆盖层渲染 WebPage
- openInAppWebView 分流:/os 模式 → OS 窗口;否则 → 覆盖层(回到原页面)
- MainLayout 顶层挂载 {url && <WebPage/>};WebPage 支持 overlay 模式退出
- 调试面板移到 App 全局层(MainLayout 与 OS 均可见)
21 lines
626 B
TypeScript
21 lines
626 B
TypeScript
/**
|
||
* webViewStore.ts — 应用内网页容器(WebPage)的宿主无关状态。
|
||
*
|
||
* OS 桌面模式(/os)下容器走 os 窗口(core.web-view,openApp);
|
||
* MainLayout / 浏览器模式(/console 等)下没有窗口系统,容器以
|
||
* 全屏覆盖层形式渲染在 MainLayout 顶层,由本 store 驱动开关。
|
||
*/
|
||
import { create } from "zustand";
|
||
|
||
interface WebViewState {
|
||
url: string | null;
|
||
open: (url: string) => void;
|
||
close: () => void;
|
||
}
|
||
|
||
export const useWebViewStore = create<WebViewState>((set) => ({
|
||
url: null,
|
||
open: (url) => set({ url }),
|
||
close: () => set({ url: null }),
|
||
}));
|