添加浏览器全屏支持检测,对不支持全屏的浏览器进行提示

This commit is contained in:
fangxiang 2022-04-20 11:16:45 +08:00
parent 7237cc4e96
commit 2ca1699364
2 changed files with 27 additions and 1 deletions

View File

@ -471,4 +471,7 @@ export default {
CN_BERWEEN_SUFFIX: "之间", CN_BERWEEN_SUFFIX: "之间",
"full screen": "全屏", "full screen": "全屏",
"exit full screen": "退出全屏", "exit full screen": "退出全屏",
"on the iPad, only Safari supports full screen":
"在iPad上, 只有Safari浏览器支持全屏",
"the current browser does not support full screen": "当前浏览器不支持全屏",
}; };

View File

@ -24,6 +24,7 @@
/> />
<q-btn <q-btn
class="col-auto" class="col-auto"
v-if="true || $q.fullscreen.isCapable"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -151,10 +152,32 @@ export default defineComponent({
plan_running, plan_running,
toogleFullScreen() { toogleFullScreen() {
if (!$q.fullscreen.isCapable) {
if ($q.platform.is.ipad) {
$q.notify({
type: "warning",
message:
$t.t("on the iPad, only Safari supports full screen") + "!",
position: "top",
timeout: 1500,
});
} else {
$q.notify({
type: "warning",
message:
$t.t("the current browser does not support full screen") + "!",
position: "top",
timeout: 1500,
});
}
return;
}
if ($q.fullscreen.isActive) { if ($q.fullscreen.isActive) {
$q.fullscreen.exit(); $q.fullscreen.exit();
} else { } else {
AppFullscreen.request(); AppFullscreen.request().catch((e: any) => {
console.log(e);
});
} }
}, },
}; };