feat: 增加webview组件封装,统一webview渲染方式

pull/64/head
moonrailgun 3 years ago
parent 11b68ea2f7
commit fcc2684a34

@ -1,5 +1,6 @@
import React from 'react';
import { Translate } from '../translate';
import { Webview } from '@capital/component';
const GroupWebPanelRender: React.FC<{ panelInfo: any }> = (props) => {
const panelInfo = props.panelInfo;
@ -11,7 +12,7 @@ const GroupWebPanelRender: React.FC<{ panelInfo: any }> = (props) => {
const url = panelInfo?.meta?.url;
return (
<iframe key={String(url)} className="w-full h-full bg-white" src={url} />
<Webview key={String(url)} className="w-full h-full bg-white" url={url} />
);
};
GroupWebPanelRender.displayName = 'GroupWebPanelRender';

@ -0,0 +1,17 @@
import React from 'react';
interface WebviewProps {
url: string;
className?: string;
style?: React.CSSProperties;
}
/**
*
*/
export const Webview: React.FC<WebviewProps> = React.memo((props) => {
return (
<iframe className={props.className} style={props.style} src={props.url} />
);
});
Webview.displayName = 'Webview';

@ -56,3 +56,4 @@ export { ErrorBoundary } from '@/components/ErrorBoundary';
export { UserAvatar } from '@/components/UserAvatar';
export { UserName } from '@/components/UserName';
export { Markdown } from '@/components/Markdown';
export { Webview } from '@/components/Webview';

Loading…
Cancel
Save