Use optional chaining for onMounted sidebar

This commit is contained in:
Norm 2022-08-07 20:38:13 -04:00 committed by Gitea
parent 4fcbf3af36
commit e6daf45cd7

View file

@ -78,7 +78,7 @@ watch(iconOnly, () => {
});
onMounted(() => {
if (sidebar && sidebar.parentElement) {
if (sidebar?.parentElement) {
const sticky = new StickySidebar(sidebar.parentElement, 16);
window.addEventListener('scroll', () => {
sticky.calc(window.scrollY);