set page mode

This commit is contained in:
Qiuxia Fan 2022-04-27 15:07:40 +08:00
parent 02f5c4b976
commit eac922c8e4
2 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,11 @@ if (!appStore.utc) {
ElMessage.error(res.errors);
}
}
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
appStore.setIsMobile(true);
} else {
appStore.setIsMobile(false);
}
</script>
<style lang="scss" scoped>
.app-main {

View File

@ -33,6 +33,7 @@ interface AppState {
autoRefresh: boolean;
pageTitle: string;
version: string;
isMobile: boolean;
}
export const appStore = defineStore({
@ -51,6 +52,7 @@ export const appStore = defineStore({
autoRefresh: false,
pageTitle: "",
version: "",
isMobile: false,
}),
getters: {
duration(): Duration {
@ -121,6 +123,9 @@ export const appStore = defineStore({
this.utcHour = utcHour;
this.utc = `${utcHour}:${utcMin}`;
},
setIsMobile(mode: boolean) {
this.isMobile = mode;
},
setEventStack(funcs: (() => void)[]): void {
this.eventStack = funcs;
},