From 64b455dfa60cb3d15fb958fffb28b9a64ec1ba43 Mon Sep 17 00:00:00 2001 From: Seven Date: Wed, 24 Dec 2025 04:38:27 +0700 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E5=91=BD=E5=90=8D=20QRSca?= =?UTF-8?q?nner=20=E5=87=BD=E6=95=B0=EF=BC=8C=E7=BB=9F=E4=B8=80=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useQRScanner.ts | 10 +++++----- src/views/user/index.vue | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/composables/useQRScanner.ts b/src/composables/useQRScanner.ts index ac79842..f7f7c3c 100644 --- a/src/composables/useQRScanner.ts +++ b/src/composables/useQRScanner.ts @@ -18,17 +18,17 @@ export function useQRScanner() { const { vibrate } = useHaptics(); const isSupported = Capacitor.isNativePlatform(); - const showError = async (message: string) => { + async function showError(message: string) { const toast = await toastController.create({ message, duration: 2000, - position: "top", + position: "bottom", color: "danger", }); await toast.present(); }; - const openScanner = async (options?: ScannerOptions): Promise => { + async function open(options?: ScannerOptions): Promise { try { if (!isSupported) { await showError(t("scanner.notSupported")); @@ -62,10 +62,10 @@ export function useQRScanner() { } return null; } - }; + } return { isSupported, - openScanner, + open, }; } diff --git a/src/views/user/index.vue b/src/views/user/index.vue index 4bc85eb..810f5ca 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -10,7 +10,7 @@ import WalletCard from "./components/wallet-card.vue"; const { vibrate } = useHaptics(); const walletStore = useWalletStore(); -const { openScanner } = useQRScanner(); +const { open } = useQRScanner(); async function handleRefresh(event: RefresherCustomEvent) { vibrate(); @@ -23,7 +23,7 @@ async function handleRefresh(event: RefresherCustomEvent) { // 处理扫描二维码 async function handleScan() { vibrate(); - const result = await openScanner({ + const result = await open({ title: "扫描二维码", });