From b569883d2547a21a281eb7152ec15044d1bf95d8 Mon Sep 17 00:00:00 2001 From: Phoenix <64720302+Concur-max@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:42:29 +0800 Subject: [PATCH] s --- src/utils/self-adaption.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/self-adaption.js b/src/utils/self-adaption.js index 60154ed..22fa70b 100644 --- a/src/utils/self-adaption.js +++ b/src/utils/self-adaption.js @@ -1,5 +1,4 @@ import { ref, onMounted, onBeforeUnmount } from 'vue'; - export function useAdaptation(handleChange) { const mediaQuery = '(max-width: 768px)'; const currentDevice = ref(window.matchMedia(mediaQuery).matches ? 'mobile' : 'pc'); @@ -12,8 +11,8 @@ export function useAdaptation(handleChange) { const mediaQueryChangeHandler = event => { const newDevice = event.matches ? 'mobile' : 'pc'; - changeHandler(newDevice); // 使用钩子函数 - currentDevice.value = newDevice; // 更新currentDevice值 + changeHandler(newDevice); + currentDevice.value = newDevice; }; let mediaQueryList;