【发布时间】:2022-12-24 02:03:57
【问题描述】:
我想做什么:
我使用来自 Tauri 的
appWindow
访问
appWindow.minimize()
、
appWindow.toggleMaximize()
和
appWindow.close()
以创建
custom title bar
。
代码是什么样的:
import { appWindow } from "@tauri-apps/api/window";
const CustomTitleBar = () => {
const hasLoaded = hasLoadedCSR(); // custom hook for checking if component has mounted using useEffect
if (typeof window === "undefined") return <>>; // 1st attempt to disable s-s-r for this component
if (!hasLoaded) return <>>; // 2nd attempt to disable s-s-r for this component
return (
<>
>
);
};
export default CustomTitleBar;
我基本上做了 2 次尝试来解决这个问题,因为我绝对认为这是由 F***Lars 在类似问题中提到的 s-s-r 引起的。