Commit 679c2e7b authored by 杨思琦's avatar 杨思琦

fix: 大屏退出修改

parent 0a59db82
Pipeline #88049 passed with stages
......@@ -14,7 +14,7 @@ const TabWidget = props => {
fullscreen: !(props.params !== undefined && props.params.fullscreen === 'true'),
});
const { linkUrl, fullscreen, bgColor } = params;
const [ref, isFullscreen, handleFullScreen, handleExitFullScreen, handleExit] = useFullScreen(fullscreen);
const [ref, isFullscreen, handleFullScreen, handleExit] = useFullScreen(fullscreen);
const goToPath = (name, data, widgetId) => {
try {
const routes = window.globalConfig?.allWidgets || [];
......@@ -74,9 +74,9 @@ const TabWidget = props => {
<div className={styles['oper-btn']}>
{isFullscreen ? (
<>
<div className={styles['btn-fullscreen_container']}>
{/* <div className={styles['btn-fullscreen_container']}>
<span className={styles['btn-fullscreen_reduce']} onClick={handleExitFullScreen} />
</div>
</div> */}
<div className={styles['btn-fullscreen_container']} style={{ marginLeft: '8px' }}>
<span className={styles['btn-fullscreen_exit']} onClick={handleExit} />
</div>
......
......@@ -6,6 +6,9 @@ const useFullScreen = needFullscreen => {
useEffect(() => {
const handleToggleFullScreen = () => {
if (!document.fullscreenElement && window.location.pathname !== `/civbase/${window.globalConfig.homepage}`) {
window.history.replaceState({ delete: true }, null, `/civbase/${window.globalConfig.homepage}`);
}
setIsFullscreen(!!document.fullscreenElement);
};
document.addEventListener('fullscreenchange', handleToggleFullScreen);
......@@ -23,7 +26,6 @@ const useFullScreen = needFullscreen => {
}, []);
const handleExit = useCallback(() => {
window.history.replaceState({ delete: true }, null, `/civbase/${window.globalConfig.homepage}`);
document.exitFullscreen();
}, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment