2021-01-22 06:24:50 +08:00
|
|
|
<template>
|
|
|
|
<v-list dense>
|
|
|
|
<v-list-item
|
|
|
|
v-for="control in controls"
|
|
|
|
:key="control.title"
|
|
|
|
link
|
|
|
|
:to="isRouterLink(control) ? control.link : null"
|
2021-01-22 11:11:24 +08:00
|
|
|
:nuxt="isRouterLink(control)"
|
2021-01-22 06:24:50 +08:00
|
|
|
:href="isRouterLink(control) ? null : control.link"
|
2021-01-22 11:11:24 +08:00
|
|
|
@click="control.action ? control.action() : null"
|
2021-01-22 06:24:50 +08:00
|
|
|
>
|
|
|
|
<v-list-item-icon>
|
|
|
|
<v-icon color="white">{{ control.icon }}</v-icon>
|
|
|
|
</v-list-item-icon>
|
|
|
|
<v-list-item-content>
|
|
|
|
<v-list-item-title>{{ control.title }}</v-list-item-title>
|
|
|
|
</v-list-item-content>
|
|
|
|
</v-list-item>
|
|
|
|
</v-list>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from 'nuxt-property-decorator';
|
|
|
|
import { Prop } from 'vue-property-decorator';
|
|
|
|
import { PropType } from 'vue';
|
|
|
|
|
|
|
|
export interface Control {
|
|
|
|
icon: String;
|
|
|
|
title: String;
|
2021-01-22 11:11:24 +08:00
|
|
|
link?: String;
|
|
|
|
action?: Function;
|
2021-01-22 06:24:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class Card extends Vue {
|
|
|
|
@Prop({ type: Array as PropType<Control[]>, required: true })
|
2021-01-22 07:08:06 +08:00
|
|
|
controls!: Control[];
|
2021-01-22 06:24:50 +08:00
|
|
|
|
|
|
|
isRouterLink(control: Control): Boolean {
|
2021-01-22 11:11:24 +08:00
|
|
|
return !!control.link && control.link.startsWith('/');
|
2021-01-22 06:24:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.announcement {
|
|
|
|
text-align: center;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.announcement-text {
|
|
|
|
padding: 0.25rem 0;
|
|
|
|
}
|
|
|
|
</style>
|