Fixes event target error for categorylistitems

This commit is contained in:
Karsa
2023-05-08 08:47:34 +02:00
parent ac7ddb89bd
commit 2c3ae629e1
@@ -23,7 +23,8 @@ const props = defineProps<{
const { selectedCategory } = useCategoryView()
function onClick(event: Event) {
const id = '#' + (event.target as HTMLAnchorElement).href!.split('#')[1]
const target = (event.target as HTMLElement).nodeName === 'span' ? (event.target as HTMLElement).parentNode : event.target as HTMLElement
const id = '#' + (target as HTMLAnchorElement).href!.split('#')[1]
const decodedId = decodeURIComponent(id)
selectedCategory.value = decodedId.replace('#', '')