update: mobile navbar

This commit is contained in:
Tony Yang
2025-04-17 11:30:07 +08:00
parent dbb4598164
commit d90d2c5e3c
4 changed files with 38 additions and 13 deletions
+14
View File
@@ -0,0 +1,14 @@
import { reactive } from 'vue';
const mobileMediaQuery = 'screen and (max-width: 768px)';
const matchMedia = window.matchMedia(mobileMediaQuery);
const isMobile = reactive(matchMedia.matches);
matchMedia.addEventListener('change', (event) => {
isMobile = event.matches;
});
export const install = (app) => {
app.config.globalProperties.$isMobile = isMobile;
}