refactor ts
This commit is contained in:
		
							
								
								
									
										14
									
								
								src/utils/dynamicTitle.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/utils/dynamicTitle.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | ||||
| import defaultSettings from '@/settings'; | ||||
| import { useSettingsStore } from '@/store/modules/settings'; | ||||
|  | ||||
| /** | ||||
|  * 动态修改标题 | ||||
|  */ | ||||
| export const useDynamicTitle = () => { | ||||
| 	const settingsStore = useSettingsStore(); | ||||
| 	if (settingsStore.dynamicTitle) { | ||||
| 		document.title = settingsStore.title + ' - ' + import.meta.env.VITE_APP_TITLE; | ||||
| 	} else { | ||||
| 		document.title = defaultSettings.title as string; | ||||
| 	} | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user
	 LiuHao
					LiuHao