koel/resources/assets/js/components/layout/main-wrapper/sidebar/SidebarItem.vue

24 lines
530 B
Vue
Raw Normal View History

<template>
<li>
<a :class="active && 'active'" :href="props.href">
2023-11-10 13:16:06 +00:00
<Icon :icon="props.icon" fixed-width />
<span>
<slot />
</span>
</a>
</li>
</template>
<script lang="ts" setup>
import { Component, ref } from 'vue'
import { useRouter } from '@/composables'
const props = defineProps<{ href: string; icon: Component, screen: ScreenName }>()
const active = ref(false)
const { onRouteChanged } = useRouter()
onRouteChanged(route => active.value = route.screen === props.screen)
</script>