2020-03-12 14:29:21 +01:00
|
|
|
<template>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li class="setting-menu-item" :class="{ active: isActive }">
|
2020-06-25 11:36:35 +02:00
|
|
|
<router-link v-if="to" :to="to">
|
|
|
|
<span>{{ title }}</span>
|
2020-02-18 08:57:00 +01:00
|
|
|
</router-link>
|
2020-06-25 11:36:35 +02:00
|
|
|
<span v-else>{{ title }}</span>
|
2020-02-18 08:57:00 +01:00
|
|
|
</li>
|
2020-03-12 14:29:21 +01:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from "vue";
|
|
|
|
import { useRoute } from "vue-router";
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
title?: string;
|
|
|
|
to: { name: string; params?: Record<string, any> };
|
|
|
|
}>();
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const route = useRoute();
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const isActive = computed((): boolean => {
|
|
|
|
if (props.to.name === route.name) {
|
|
|
|
if (props.to.params) {
|
|
|
|
return props.to.params.identityName === route.params.identityName;
|
2020-03-12 14:29:21 +01:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
return true;
|
2020-03-12 14:29:21 +01:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
return false;
|
|
|
|
});
|
2020-03-12 14:29:21 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
li.setting-menu-item {
|
|
|
|
font-size: 1.05rem;
|
|
|
|
background-color: #fff1de;
|
|
|
|
margin: auto;
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
span {
|
|
|
|
padding: 5px 15px;
|
|
|
|
display: block;
|
|
|
|
}
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
a {
|
|
|
|
display: block;
|
|
|
|
color: inherit;
|
|
|
|
}
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
&:hover,
|
|
|
|
&.active {
|
|
|
|
cursor: pointer;
|
|
|
|
background-color: lighten(#fea72b, 10%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|