From 28f5cd9731796ccb5900bfdbebfc15e21b867a53 Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Sat, 12 Mar 2022 23:18:04 +0800 Subject: [PATCH 1/2] docs: functions count [ci:skip] --- packages/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/index.md b/packages/index.md index 11022b19aab..b79d98287ef 100644 --- a/packages/index.md +++ b/packages/index.md @@ -6,7 +6,7 @@ description: Vue is designed from the ground up to be incrementally adoptable. T features: - title: 🎛 Feature Rich - details: 140+ functions for you to choose from + details: 200+ functions for you to choose from - title: 🕶 Seamless migration details: Works for both Vue 3 and 2 - title: ⚡ Fully tree shakeable From 43f2673dea7b2db9f71a48cb9eed882eb720024c Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Sat, 7 May 2022 18:18:11 +0800 Subject: [PATCH 2/2] fix(useMediaQuery): normalize isSupported flag --- packages/core/useMediaQuery/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/useMediaQuery/index.ts b/packages/core/useMediaQuery/index.ts index 0c97de31b87..03b1f339e40 100644 --- a/packages/core/useMediaQuery/index.ts +++ b/packages/core/useMediaQuery/index.ts @@ -14,15 +14,16 @@ import { defaultWindow } from '../_configurable' */ export function useMediaQuery(query: string, options: ConfigurableWindow = {}) { const { window = defaultWindow } = options + const isSupported = Boolean(window && 'matchMedia' in window) let mediaQuery: MediaQueryList | undefined const matches = ref(false) const update = () => { - if (!window) + if (!isSupported) return if (!mediaQuery) - mediaQuery = window.matchMedia(query) + mediaQuery = window!.matchMedia(query) matches.value = mediaQuery.matches }