fix(table): make sure the editing line is working, fix #439

This commit is contained in:
Vben
2021-04-01 00:52:31 +08:00
parent 8a14069e71
commit b54b794264
14 changed files with 196 additions and 53 deletions

View File

@@ -1,22 +1,29 @@
import { watch, unref } from 'vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { useTitle as usePageTitle } from '@vueuse/core';
import { useGlobSetting } from '/@/hooks/setting';
import { useRouter } from 'vue-router';
import { REDIRECT_NAME } from '/@/router/constant';
import { listenerRouteChange } from '/@/logics/mitt/routeChange';
export function useTitle() {
const { title } = useGlobSetting();
const { t } = useI18n();
const { currentRoute } = useRouter();
const pageTitle = usePageTitle();
listenerRouteChange((route) => {
if (route.name === REDIRECT_NAME) {
return;
}
watch(
() => currentRoute.value.path,
() => {
const route = unref(currentRoute);
if (route.name === REDIRECT_NAME) {
return;
}
const tTitle = t(route?.meta?.title as string);
pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}`;
});
const tTitle = t(route?.meta?.title as string);
pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}`;
},
{ immediate: true }
);
}