新增模块
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { useEffect } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
const DEFAULT_TITLE = 'EIOSpace';
|
||||
|
||||
/** 模块页浏览器页签标题:挂载时设置 document.title,卸载时恢复默认 */
|
||||
export default function ModuleTitle({ title, children }: { title: string; children: ReactNode }) {
|
||||
useEffect(() => {
|
||||
document.title = title;
|
||||
return () => {
|
||||
document.title = DEFAULT_TITLE;
|
||||
};
|
||||
}, [title]);
|
||||
return <>{children}</>;
|
||||
}
|
||||
Reference in New Issue
Block a user