mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-24 04:10:20 +08:00
fix(use-redo): refresh the page to keep the parameters(#104)
This commit is contained in:
parent
2f75a94889
commit
e04aaa0645
@ -22,6 +22,7 @@
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- 修复 tree 文本超出挡住操作按钮问题
|
||||
- 修复通过 useRedo 刷新页面参数丢失问题
|
||||
|
||||
### 🎫 Chores
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,18 +0,0 @@
|
||||
import { watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useGlobSetting } from '../setting';
|
||||
import { useI18n } from './useI18n';
|
||||
import { setTitle } from '/@/utils/browser';
|
||||
|
||||
export function useTitle() {
|
||||
const { currentRoute } = useRouter();
|
||||
const { t } = useI18n();
|
||||
watch(
|
||||
() => currentRoute.value.path,
|
||||
() => {
|
||||
const globSetting = useGlobSetting();
|
||||
setTitle(t(currentRoute.value.meta.title), globSetting.title);
|
||||
},
|
||||
{ immediate: true, flush: 'post' }
|
||||
);
|
||||
}
|
@ -24,4 +24,5 @@ export default {
|
||||
|
||||
list: 'List page',
|
||||
listCard: 'Card list',
|
||||
basic: 'Basic list',
|
||||
};
|
||||
|
@ -24,4 +24,5 @@ export default {
|
||||
|
||||
list: '列表页',
|
||||
listCard: '卡片列表',
|
||||
basic: '标准列表',
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1,6 +1,3 @@
|
||||
<template>
|
||||
<div />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, unref } from 'vue';
|
||||
|
||||
@ -26,7 +23,7 @@
|
||||
appStore.setPageLoadingAction(false);
|
||||
}, 0);
|
||||
}
|
||||
return {};
|
||||
return () => null;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user