动态修改title

This commit is contained in:
黄心宇 2023-09-21 14:05:27 +08:00
parent db9bfa7576
commit baed9df260
1 changed files with 6 additions and 0 deletions

View File

@ -43,8 +43,13 @@ function memo_show(props) {
useEffect(() => {
init();
related_memos();
return componentWillUnmount
}, [memo_id]);
function componentWillUnmount() {
document.title = '论坛交流'
}
async function init() {
setSpinType(true);
let url = `/memos/${memo_id}.json`;
@ -69,6 +74,7 @@ function memo_show(props) {
setRecentmemos(result.data.recent_memos);
setIsBanned(result.data.is_banned);
getMemoUser(result.data.author_info);
document.title = `${result.data.memo.subject}/${result.data.memo.forum_tag && result.data.memo.forum_tag.title}`
}
setSpinType(false);
})