Use optional chaining for onMounted sidebar

This commit is contained in:
Norm 2022-08-07 20:38:13 -04:00
parent 0bf85bed43
commit 27df713afb

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);