From 71c0de151c85c8885952abecffcf6948aa7dcaec Mon Sep 17 00:00:00 2001 From: h_mo <596417202@qq.com> Date: Mon, 1 May 2023 00:31:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8uni-mini-router?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/App.vue | 7 -- src/components/Navbar/index.vue | 2 +- src/hooks/router.ts | 44 ------------ src/main.ts | 6 +- src/pages.json | 13 ++-- src/pages/about/index.vue | 2 +- src/pages/demo/index.vue | 5 +- src/pages/index/index.vue | 5 +- src/pages/login/index.vue | 12 ++-- src/pages/notFound/404.vue | 6 +- src/pagesA/list/test1/index.vue | 2 +- src/pagesA/list/test2/index.vue | 2 +- src/router/guard.ts | 39 ++++++++++ src/router/index.ts | 19 +++++ src/state/modules/router.ts | 35 --------- src/types.d.ts | 2 + src/types/router/route.d.ts | 32 --------- src/utils/router/constant.ts | 38 ---------- src/utils/router/interceptor.ts | 75 ------------------- src/utils/router/navigates.ts | 123 -------------------------------- src/utils/router/routes.ts | 41 ----------- vite.config.ts | 2 + 23 files changed, 94 insertions(+), 420 deletions(-) delete mode 100644 src/hooks/router.ts create mode 100644 src/router/guard.ts create mode 100644 src/router/index.ts delete mode 100644 src/state/modules/router.ts create mode 100644 src/types.d.ts delete mode 100644 src/types/router/route.d.ts delete mode 100644 src/utils/router/constant.ts delete mode 100644 src/utils/router/interceptor.ts delete mode 100644 src/utils/router/navigates.ts delete mode 100644 src/utils/router/routes.ts diff --git a/package.json b/package.json index 64d8332..09e004f 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "lodash-es": "^4.17.21", "pinia": "^2.0.35", "qs": "^6.11.1", + "uni-read-pages-vite": "^0.0.5", "vue": "^3.2.47" }, "devDependencies": { @@ -87,6 +88,7 @@ "prettier": "^2.8.8", "sass": "^1.62.1", "typescript": "^5.0.4", + "uni-mini-router": "^0.0.7", "unocss": "^0.46.5", "unocss-preset-weapp": "^0.2.5", "vite": "^4.3.2", diff --git a/src/App.vue b/src/App.vue index 1ae0729..610e6eb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,8 @@ diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 6e9a83c..cd7cb61 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -2,7 +2,7 @@ import { ref } from 'vue'; import BasicButton from '@/components/BasicButton/index.vue'; import AppProvider from '@/components/AppProvider/inedx.vue'; -import { useRouter } from '@/hooks/router'; +import { useRouter } from 'uni-mini-router'; import { CURRENT_PLATFORM, PLATFORMS } from '@/enums/platformEnum'; import { judgePlatform } from '@/utils/platform'; import Iconify from '@/components/Iconify/index.vue'; @@ -18,8 +18,7 @@ const isVue3 = judgePlatform(PLATFORMS.VUE3); const router = useRouter(); const handleGetStarted = () => { - router.pushTab('/pages/demo/index'); - // router.push('/pages/log/index?id=4345&title=log'); + router.pushTab({ path: '/pages/demo/index' }); };