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 }">
|
|
|
|
<router-link v-if="menuItem.to" :to="menuItem.to">
|
|
|
|
<span>{{ menuItem.title }}</span>
|
|
|
|
</router-link>
|
|
|
|
<span v-else>{{ menuItem.title }}</span>
|
|
|
|
</li>
|
2020-03-12 14:29:21 +01:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import { ISettingMenuSection } from "@/types/setting-menu.model";
|
2020-03-12 14:29:21 +01:00
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class SettingMenuItem extends Vue {
|
|
|
|
@Prop({ required: true, type: Object }) menuItem!: ISettingMenuSection;
|
|
|
|
|
|
|
|
get isActive() {
|
|
|
|
if (!this.menuItem.to) return false;
|
|
|
|
if (this.menuItem.to.name === this.$route.name) {
|
|
|
|
if (this.menuItem.to.params) {
|
|
|
|
return this.menuItem.to.params.identityName === this.$route.params.identityName;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
@import "@/variables.scss";
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
li.setting-menu-item {
|
|
|
|
font-size: 1.05rem;
|
|
|
|
background-color: #fff1de;
|
|
|
|
color: $primary;
|
|
|
|
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>
|