= React.memo((props) => {
- const { spinning = false, className, style } = props;
+ const { spinning = false, className, style, tip } = props;
return (
@@ -22,7 +23,7 @@ export const Loading: React.FC = React.memo((props) => {
}
)}
>
-
+
{props.children}
diff --git a/client/web/src/components/Webview.tsx b/client/web/src/components/Webview.tsx
index 7b42933aa65..cd2b0e451d7 100644
--- a/client/web/src/components/Webview.tsx
+++ b/client/web/src/components/Webview.tsx
@@ -1,5 +1,7 @@
-import React from 'react';
+import React, { useEffect, useRef, useState } from 'react';
+import { t } from 'tailchat-shared';
import { withKeepAliveOverlay } from './KeepAliveOverlay';
+import { Loading } from './Loading';
interface WebviewProps {
className?: string;
@@ -11,7 +13,29 @@ interface WebviewProps {
* 网页渲染容器
*/
export const Webview: React.FC = (props) => {
- return ;
+ const ref = useRef(null);
+ const [spinning, setSpinning] = useState(true);
+
+ useEffect(() => {
+ const callback = () => {
+ setSpinning(false);
+ };
+ ref.current?.addEventListener('load', callback);
+
+ return () => {
+ ref.current?.removeEventListener('load', callback);
+ };
+ }, []);
+
+ return (
+
+
+
+ );
};
Webview.displayName = 'Webview';