diff --git a/themes/plog/components/Modal.js b/themes/plog/components/Modal.js index 8c490093..17ae4da6 100644 --- a/themes/plog/components/Modal.js +++ b/themes/plog/components/Modal.js @@ -34,7 +34,7 @@ export default function Modal(props) { // 修改当前显示的遮罩内容 function prev() { setLoading(true) - const index = posts.findIndex(post => post.slug === modalContent.slug) + const index = posts?.findIndex(post => post.slug === modalContent.slug) if (index === 0) { setModalContent(posts[posts.length - 1]) } else { @@ -90,10 +90,11 @@ export default function Modal(props) { {!loading && (<>