mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-11-29 18:49:08 +08:00
fix(FullScreenButton): update fullscreen state icon (#4642)
* fix: update fullscreen state icon * refactor: 重构代码提高可读性
This commit is contained in:
parent
cf8e25ca72
commit
a4084e7b82
@ -14,7 +14,7 @@ export async function toggle(options) {
|
||||
|
||||
if (el !== null) {
|
||||
if (isFullscreen()) {
|
||||
await document.exitFullscreen()
|
||||
await exitFullscreen(el);
|
||||
}
|
||||
else {
|
||||
await enterFullscreen(el);
|
||||
@ -25,12 +25,22 @@ export async function toggle(options) {
|
||||
const enterFullscreen = async el => {
|
||||
await el.requestFullscreen();
|
||||
|
||||
if (!isFullscreen()) {
|
||||
el.classList.remove('bb-fs-open');
|
||||
document.documentElement.classList.remove('bb-fs-open');
|
||||
updateFullscreenState(el);
|
||||
}
|
||||
|
||||
const exitFullscreen = async el => {
|
||||
await document.exitFullscreen()
|
||||
|
||||
updateFullscreenState(el);
|
||||
}
|
||||
|
||||
const updateFullscreenState = el => {
|
||||
if (isFullscreen()) {
|
||||
el.classList.add('bb-fs-open')
|
||||
}
|
||||
else {
|
||||
el.classList.add('bb-fs-open')
|
||||
el.classList.remove('bb-fs-open');
|
||||
document.documentElement.classList.remove('bb-fs-open');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user