You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/web/src/components/Webview.tsx

27 lines
664 B
TypeScript

import React from 'react';
import { withKeepAliveOverlay } from './KeepAliveOverlay';
interface WebviewProps {
className?: string;
style?: React.CSSProperties;
url: string;
}
/**
* 网页渲染容器
*/
export const Webview: React.FC<WebviewProps> = (props) => {
return <iframe className="w-full h-full" src={props.url} />;
};
Webview.displayName = 'Webview';
/**
* 带缓存的网页渲染容器
* 用于需要在切换时依旧保持加载的case
*/
export const WebviewKeepAlive: React.FC<WebviewProps> =
withKeepAliveOverlay<WebviewProps>(Webview, {
cacheId: (props) => props.url,
});
WebviewKeepAlive.displayName = 'WebviewKeepAlive';