document 非空判断

This commit is contained in:
tangly1024
2022-04-26 12:50:35 +08:00
parent 0b65e240bc
commit 1a7efd80ac
10 changed files with 15 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ const Slug = props => {
useEffect(() => {
setTimeout(() => {
if (window) {
const article = document.getElementById('container')
const article = typeof document !== 'undefined' && document.getElementById('container')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)