shack/renderer/Link.vue

22 lines
314 B
Vue

<template>
<a :class="{ active: pageContext.urlPathname === $attrs.href }">
<slot />
</a>
</template>
<script setup>
import { usePageContext } from './usePageContext';
const pageContext = usePageContext();
</script>
<style scoped>
a {
padding: 3px 10px;
}
a.active {
background-color: #eee;
}
</style>