处理图标页全屏后无法渲染的问题

This commit is contained in:
21030442-mao 2021-07-27 10:13:16 +08:00
parent 0050120d79
commit fd5d763de4
2 changed files with 23 additions and 22 deletions

View File

@ -190,7 +190,7 @@ export default {
const { meta, name, params, query } = currentRouteInfo;
if (meta.isDynamic) router.push({ name, params });
else router.push({ path, query });
store.dispatch('tagsViewRoutes/setCurrenFullscreen');
store.dispatch('tagsViewRoutes/setCurrenFullscreen', 500);
});
};
// tagsView

View File

@ -29,33 +29,34 @@ const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
commit('getTagsViewRoutes', data);
},
// 设置卡片全屏
setCurrenFullscreen({ commit }) {
setCurrenFullscreen({ commit }, timeout: number = 0) {
const screenfulls: any = screenfull;
if (!screenfulls.isEnabled) {
ElMessage.warning('暂不不支持全屏');
return false;
}
screenfulls.toggle();
const currenFullscreenChange = () => {
const layoutViewBgWhite = document.querySelector('.layout-view-bg-white') as HTMLElement;
if (screenfulls.isFullscreen) {
commit('getCurrenFullscreen', true);
// 设置全屏时,设置有 `layout-view-bg-white` 类的高度
if (layoutViewBgWhite) layoutViewBgWhite.style.height = `calc(100vh - 30px)`;
} else {
screenfulls.off('change', currenFullscreenChange);
commit('getCurrenFullscreen', false);
if (!layoutViewBgWhite) return false;
const getThemeConfig = Local.get('themeConfig');
if (getThemeConfig) {
let { isTagsview } = getThemeConfig;
if (isTagsview) layoutViewBgWhite.style.height = `calc(100vh - 114px)`;
else layoutViewBgWhite.style.height = `calc(100vh - 80px)`;
setTimeout(() => {
const currenFullscreenChange = () => {
const layoutViewBgWhite = document.querySelector('.layout-view-bg-white') as HTMLElement;
if (screenfulls.isFullscreen) {
commit('getCurrenFullscreen', true);
// 设置全屏时,设置有 `layout-view-bg-white` 类的高度
if (layoutViewBgWhite) layoutViewBgWhite.style.height = `calc(100vh - 30px)`;
} else {
screenfulls.off('change', currenFullscreenChange);
commit('getCurrenFullscreen', false);
if (!layoutViewBgWhite) return false;
const getThemeConfig = Local.get('themeConfig');
if (getThemeConfig) {
let { isTagsview } = getThemeConfig;
if (isTagsview) layoutViewBgWhite.style.height = `calc(100vh - 114px)`;
else layoutViewBgWhite.style.height = `calc(100vh - 80px)`;
}
}
}
};
screenfulls.on('change', currenFullscreenChange);
commit('getCurrenFullscreen', true);
};
screenfulls.on('change', currenFullscreenChange);
screenfulls.toggle();
}, timeout);
},
},
};