Skip to content

Commit

Permalink
fix(use-redo): refresh the page to keep the parameters(#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Nov 26, 2020
1 parent 2f75a94 commit e04aaa0
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
### 🐛 Bug Fixes

- 修复 tree 文本超出挡住操作按钮问题
- 修复通过 useRedo 刷新页面参数丢失问题

### 🎫 Chores

Expand Down
3 changes: 3 additions & 0 deletions src/hooks/web/usePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ export function useGo() {
*/
export const useRedo = () => {
const { push, currentRoute } = useRouter();
const { query, params } = currentRoute.value;
function redo() {
push({
path: '/redirect' + unref(currentRoute).fullPath,
query,
params,
});
}
return redo;
Expand Down
18 changes: 0 additions & 18 deletions src/hooks/web/useTitle.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/locales/lang/en/routes/demo/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export default {

list: 'List page',
listCard: 'Card list',
basic: 'Basic list',
};
1 change: 1 addition & 0 deletions src/locales/lang/zh_CN/routes/demo/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export default {

list: '列表页',
listCard: '卡片列表',
basic: '标准列表',
};
2 changes: 1 addition & 1 deletion src/router/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function createGuard(router: Router) {
router.afterEach((to) => {
const { t } = useI18n();
// change html title
setTitle(t(to.meta.title), globSetting.title);
to.name !== 'Redirect' && setTitle(t(to.meta.title), globSetting.title);
});
createProgressGuard(router);
createPermissionGuard(router);
Expand Down
2 changes: 1 addition & 1 deletion src/router/routes/modules/demo/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const page: AppRouteModule = {
name: 'ListBasicPage',
component: () => import('/@/views/demo/page/list/basic/index.vue'),
meta: {
title: '标准列表',
title: 'routes.demo.page.basic',
},
},
{
Expand Down
5 changes: 1 addition & 4 deletions src/views/sys/redirect/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<template>
<div />
</template>
<script lang="ts">
import { defineComponent, unref } from 'vue';
Expand All @@ -26,7 +23,7 @@
appStore.setPageLoadingAction(false);
}, 0);
}
return {};
return () => null;
},
});
</script>

0 comments on commit e04aaa0

Please sign in to comment.