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 name="viewport" content="initial-scale=1, width=device-width" />
<meta <meta
http-equiv="Content-Security-Policy" 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> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View File

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