From 7ad6dddb07bc24ba0d1a9de293cb65f9822b9086 Mon Sep 17 00:00:00 2001 From: lisonge Date: Sun, 3 Dec 2023 23:55:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/router/index.ts b/src/router/index.ts index 04b1832..4579665 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,3 +1,5 @@ +import { toValidURL } from '@/utils/check'; +import { errorTry, errorWrap } from '@/utils/error'; import { createRouter, createWebHistory } from 'vue-router'; const router = createRouter({ @@ -34,6 +36,16 @@ const router = createRouter({ path: '/device', name: 'device', component: () => import('@/views/DevicePage.vue'), + beforeEnter(to, from, next) { + const u = toValidURL(String(to.query.url)); + if (u) { + localStorage.setItem('device_link', u.origin); + const query = { ...to.query }; + delete query.url; + return next({ ...to, query }); + } + next(); + }, }, { path: '/404',