import defaultSettings from '@/settings';
import { useSettingsStore } from '@/store/modules/settings';
import { useWebsiteStore } from '@/store/modules/website';

/**
 * 动态修改标题
 */
export const useDynamicTitle = () => {
  const settingsStore = useSettingsStore();
  const websiteStore = useWebsiteStore();
  const systemTitle = websiteStore.websiteConfig.title || import.meta.env.VITE_APP_TITLE;
  if (settingsStore.dynamicTitle) {
    document.title = settingsStore.title + ' - ' + systemTitle;
  } else {
    document.title = systemTitle;
  }
};
