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 | 36 | */ |
37 | 37 | export const useRedo = () => { |
38 | 38 | const { push, currentRoute } = useRouter(); |
39 | + const { query, params } = currentRoute.value; | |
39 | 40 | function redo() { |
40 | 41 | push({ |
41 | 42 | path: '/redirect' + unref(currentRoute).fullPath, |
43 | + query, | |
44 | + params, | |
42 | 45 | }); |
43 | 46 | } |
44 | 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 | 57 | router.afterEach((to) => { |
58 | 58 | const { t } = useI18n(); |
59 | 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 | 62 | createProgressGuard(router); |
63 | 63 | createPermissionGuard(router); | ... | ... |
src/router/routes/modules/demo/page.ts
src/views/sys/redirect/index.vue