Commit e04aaa06459c6613e59aa6ae5906b998b0685bdb
1 parent
2f75a948
fix(use-redo): refresh the page to keep the parameters(#104)
Showing
8 changed files
with
9 additions
and
24 deletions
CHANGELOG.zh_CN.md
src/hooks/web/usePage.ts
@@ -36,9 +36,12 @@ export function useGo() { | @@ -36,9 +36,12 @@ export function useGo() { | ||
36 | */ | 36 | */ |
37 | export const useRedo = () => { | 37 | export const useRedo = () => { |
38 | const { push, currentRoute } = useRouter(); | 38 | const { push, currentRoute } = useRouter(); |
39 | + const { query, params } = currentRoute.value; | ||
39 | function redo() { | 40 | function redo() { |
40 | push({ | 41 | push({ |
41 | path: '/redirect' + unref(currentRoute).fullPath, | 42 | path: '/redirect' + unref(currentRoute).fullPath, |
43 | + query, | ||
44 | + params, | ||
42 | }); | 45 | }); |
43 | } | 46 | } |
44 | return redo; | 47 | return redo; |
src/hooks/web/useTitle.ts deleted
100644 → 0
1 | -import { watch } from 'vue'; | ||
2 | -import { useRouter } from 'vue-router'; | ||
3 | -import { useGlobSetting } from '../setting'; | ||
4 | -import { useI18n } from './useI18n'; | ||
5 | -import { setTitle } from '/@/utils/browser'; | ||
6 | - | ||
7 | -export function useTitle() { | ||
8 | - const { currentRoute } = useRouter(); | ||
9 | - const { t } = useI18n(); | ||
10 | - watch( | ||
11 | - () => currentRoute.value.path, | ||
12 | - () => { | ||
13 | - const globSetting = useGlobSetting(); | ||
14 | - setTitle(t(currentRoute.value.meta.title), globSetting.title); | ||
15 | - }, | ||
16 | - { immediate: true, flush: 'post' } | ||
17 | - ); | ||
18 | -} |
src/locales/lang/en/routes/demo/page.ts
src/locales/lang/zh_CN/routes/demo/page.ts
src/router/guard/index.ts
@@ -57,7 +57,7 @@ export function createGuard(router: Router) { | @@ -57,7 +57,7 @@ export function createGuard(router: Router) { | ||
57 | router.afterEach((to) => { | 57 | router.afterEach((to) => { |
58 | const { t } = useI18n(); | 58 | const { t } = useI18n(); |
59 | // change html title | 59 | // change html title |
60 | - setTitle(t(to.meta.title), globSetting.title); | 60 | + to.name !== 'Redirect' && setTitle(t(to.meta.title), globSetting.title); |
61 | }); | 61 | }); |
62 | createProgressGuard(router); | 62 | createProgressGuard(router); |
63 | createPermissionGuard(router); | 63 | createPermissionGuard(router); |
src/router/routes/modules/demo/page.ts
@@ -223,7 +223,7 @@ const page: AppRouteModule = { | @@ -223,7 +223,7 @@ const page: AppRouteModule = { | ||
223 | name: 'ListBasicPage', | 223 | name: 'ListBasicPage', |
224 | component: () => import('/@/views/demo/page/list/basic/index.vue'), | 224 | component: () => import('/@/views/demo/page/list/basic/index.vue'), |
225 | meta: { | 225 | meta: { |
226 | - title: '标准列表', | 226 | + title: 'routes.demo.page.basic', |
227 | }, | 227 | }, |
228 | }, | 228 | }, |
229 | { | 229 | { |
src/views/sys/redirect/index.vue
1 | -<template> | ||
2 | - <div /> | ||
3 | -</template> | ||
4 | <script lang="ts"> | 1 | <script lang="ts"> |
5 | import { defineComponent, unref } from 'vue'; | 2 | import { defineComponent, unref } from 'vue'; |
6 | 3 | ||
@@ -26,7 +23,7 @@ | @@ -26,7 +23,7 @@ | ||
26 | appStore.setPageLoadingAction(false); | 23 | appStore.setPageLoadingAction(false); |
27 | }, 0); | 24 | }, 0); |
28 | } | 25 | } |
29 | - return {}; | 26 | + return () => null; |
30 | }, | 27 | }, |
31 | }); | 28 | }); |
32 | </script> | 29 | </script> |