fix: add toc slug judge

This commit is contained in:
KazooTTT
2024-10-15 12:51:58 +08:00
parent f2a7ecc339
commit 3194617e79

View File

@ -35,10 +35,12 @@ const {
link.addEventListener('click', (event) => {
event.preventDefault()
const slug = link.getAttribute('data-slug')
if (slug) {
const element = document.getElementById(slug)
if (element) {
element.scrollIntoView({ behavior: 'smooth' })
}
}
})
})
})