提交 e04aaa06 编写于 作者: V vben

fix(use-redo): refresh the page to keep the parameters(#104)

上级 2f75a948
......@@ -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;
......
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',
},
},
{
......
<template>
<div />
</template>
<script lang="ts">
import { defineComponent, unref } from 'vue';
......@@ -26,7 +23,7 @@
appStore.setPageLoadingAction(false);
}, 0);
}
return {};
return () => null;
},
});
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册