mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 01:13:48 +01:00
chore(client): fix #8858
This commit is contained in:
parent
eca6735e71
commit
a827e29fe1
@ -66,6 +66,7 @@ export class Router extends EventEmitter<{
|
|||||||
private currentKey = Date.now().toString();
|
private currentKey = Date.now().toString();
|
||||||
|
|
||||||
public currentRoute: ShallowRef<RouteDef | null> = shallowRef(null);
|
public currentRoute: ShallowRef<RouteDef | null> = shallowRef(null);
|
||||||
|
public navHook: ((path: string) => boolean) | null = null;
|
||||||
|
|
||||||
constructor(routes: Router['routes'], currentPath: Router['currentPath']) {
|
constructor(routes: Router['routes'], currentPath: Router['currentPath']) {
|
||||||
super();
|
super();
|
||||||
@ -192,6 +193,10 @@ export class Router extends EventEmitter<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public push(path: string) {
|
public push(path: string) {
|
||||||
|
if (this.navHook) {
|
||||||
|
const cancel = this.navHook(path);
|
||||||
|
if (cancel) return;
|
||||||
|
}
|
||||||
const beforePath = this.currentPath;
|
const beforePath = this.currentPath;
|
||||||
this.navigate(path, null);
|
this.navigate(path, null);
|
||||||
this.emit('push', {
|
this.emit('push', {
|
||||||
|
@ -65,6 +65,13 @@ import { $i } from '@/account';
|
|||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { mainRouter } from '@/router';
|
import { mainRouter } from '@/router';
|
||||||
|
|
||||||
|
if (deckStore.state.navWindow) {
|
||||||
|
mainRouter.navHook = (path) => {
|
||||||
|
os.pageWindow(path);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const isMobile = ref(window.innerWidth <= 500);
|
const isMobile = ref(window.innerWidth <= 500);
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
isMobile.value = window.innerWidth <= 500;
|
isMobile.value = window.innerWidth <= 500;
|
||||||
|
Loading…
Reference in New Issue
Block a user