vben
2021-08-24 56a966cfbf8db5b29a42185f0f25a0e800c30dbb
src/hooks/web/useTitle.ts
@@ -6,6 +6,9 @@
import { REDIRECT_NAME } from '/@/router/constant';
/**
 * Listening to page changes and dynamically changing site titles
 */
export function useTitle() {
  const { title } = useGlobSetting();
  const { t } = useI18n();
@@ -17,6 +20,7 @@
    () => currentRoute.value.path,
    () => {
      const route = unref(currentRoute);
      if (route.name === REDIRECT_NAME) {
        return;
      }
@@ -24,6 +28,6 @@
      const tTitle = t(route?.meta?.title as string);
      pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}`;
    },
    { immediate: true }
    { immediate: true },
  );
}