2020-03-12 14:29:21 +01:00
|
|
|
<template>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li :class="{ active: sectionActive }">
|
2020-06-25 11:36:35 +02:00
|
|
|
<router-link v-if="to" :to="to">{{ title }}</router-link>
|
|
|
|
<b v-else>{{ title }}</b>
|
2020-02-18 08:57:00 +01:00
|
|
|
<ul>
|
2020-06-25 11:36:35 +02:00
|
|
|
<slot></slot>
|
2020-02-18 08:57:00 +01:00
|
|
|
</ul>
|
|
|
|
</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 SettingMenuItem from "@/components/Settings/SettingMenuItem.vue";
|
2020-06-25 11:36:35 +02:00
|
|
|
import { Route } from "vue-router";
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-03-12 14:29:21 +01:00
|
|
|
@Component({
|
|
|
|
components: { SettingMenuItem },
|
|
|
|
})
|
|
|
|
export default class SettingMenuSection extends Vue {
|
2020-06-25 11:36:35 +02:00
|
|
|
@Prop({ required: false, type: String }) title!: string;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-25 11:36:35 +02:00
|
|
|
@Prop({ required: true, type: Object }) to!: Route;
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-11-27 19:27:44 +01:00
|
|
|
get sectionActive(): boolean {
|
2020-06-25 11:36:35 +02:00
|
|
|
if (this.$slots.default) {
|
|
|
|
return this.$slots.default.some(
|
|
|
|
({
|
|
|
|
componentOptions: {
|
2020-11-27 19:27:44 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2020-06-25 11:36:35 +02:00
|
|
|
// @ts-ignore
|
|
|
|
propsData: { to },
|
|
|
|
},
|
|
|
|
}) => to && to.name === this.$route.name
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return false;
|
2020-03-12 14:29:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
li {
|
|
|
|
font-size: 1.3rem;
|
|
|
|
background-color: $secondary;
|
2020-06-17 15:54:24 +02:00
|
|
|
color: $background-color;
|
2020-02-18 08:57:00 +01:00
|
|
|
margin: 2px auto;
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
&.active {
|
|
|
|
background-color: #fea72b;
|
|
|
|
}
|
2020-03-12 14:29:21 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
a,
|
|
|
|
b {
|
|
|
|
cursor: pointer;
|
|
|
|
margin: 5px 0;
|
|
|
|
display: block;
|
|
|
|
padding: 5px 10px;
|
|
|
|
color: inherit;
|
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|