fix: minapp title null

This commit is contained in:
kangfenmao 2024-08-16 22:43:12 +08:00
parent 5e954566c9
commit 47a83fa67f
2 changed files with 14 additions and 6 deletions

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="initial-scale=1, width=device-width" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; connect-src *; script-src 'self' *; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' *; font-src 'self' data: *; img-src 'self' data:; frame-src *" />
content="default-src 'self'; connect-src *; script-src 'self' *; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' *; font-src 'self' data: *; img-src 'self' data:; frame-src * file:" />
</head>
<body>
<div id="root"></div>

View File

@ -8,7 +8,7 @@ import styled from 'styled-components'
import { TopView } from '../TopView'
interface ShowParams {
title: string
title?: string
url: string
}
@ -20,6 +20,8 @@ const PopupContainer: React.FC<Props> = ({ title, url, resolve }) => {
const [open, setOpen] = useState(true)
const iframeRef = useRef<HTMLIFrameElement>(null)
const canOpenExternalLink = url.startsWith('http://') || url.startsWith('https://')
const onClose = () => {
setOpen(false)
setTimeout(() => resolve({}), 300)
@ -37,7 +39,7 @@ const PopupContainer: React.FC<Props> = ({ title, url, resolve }) => {
return (
<Drawer
title={title}
title={title || <Title />}
placement="bottom"
onClose={onClose}
open={open}
@ -53,9 +55,11 @@ const PopupContainer: React.FC<Props> = ({ title, url, resolve }) => {
<Button onClick={onReload}>
<ReloadOutlined />
</Button>
{canOpenExternalLink && (
<Button onClick={onOpenLink}>
<ExportOutlined />
</Button>
)}
<Button onClick={onClose}>
<CloseOutlined />
</Button>
@ -70,6 +74,10 @@ const Frame = styled.iframe`
border: none;
`
const Title = styled.div`
min-height: var(--navbar-height);
`
const ButtonsGroup = styled.div`
position: absolute;
top: 0;