2020-10-02 07:13:14 +00:00
|
|
|
<template>
|
2020-10-17 10:56:25 +00:00
|
|
|
<q-item clickable tag="a" target="self" :to="{ name: link }">
|
|
|
|
<q-item-section v-if="icon" avatar>
|
2020-10-02 07:13:14 +00:00
|
|
|
<q-icon :name="icon" />
|
|
|
|
</q-item-section>
|
|
|
|
|
|
|
|
<q-item-section>
|
2020-10-17 10:56:25 +00:00
|
|
|
<q-item-label>{{ realTitle }}</q-item-label>
|
2020-10-02 07:13:14 +00:00
|
|
|
<q-item-label caption>
|
|
|
|
{{ caption }}
|
|
|
|
</q-item-label>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 10:56:25 +00:00
|
|
|
import { computed, defineComponent } from '@vue/composition-api';
|
2020-10-02 07:13:14 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'EssentialLink',
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
2020-10-17 10:56:25 +00:00
|
|
|
required: true
|
2020-10-02 07:13:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
caption: {
|
|
|
|
type: String,
|
2020-10-17 10:56:25 +00:00
|
|
|
default: ''
|
2020-10-02 07:13:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
link: {
|
|
|
|
type: String,
|
2020-10-17 10:56:25 +00:00
|
|
|
default: 'home'
|
2020-10-02 07:13:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
icon: {
|
|
|
|
type: String,
|
2020-10-17 10:56:25 +00:00
|
|
|
default: ''
|
|
|
|
}
|
2020-10-09 16:04:32 +00:00
|
|
|
},
|
2020-10-17 10:56:25 +00:00
|
|
|
|
|
|
|
setup(props, { root }) {
|
|
|
|
let title = props.title;
|
|
|
|
if (props.title.includes('loadFromStore')) {
|
|
|
|
const startIndex = props.title.indexOf('(') + 1;
|
|
|
|
const endIndex = props.title.indexOf(')');
|
|
|
|
const substring = props.title
|
|
|
|
.substring(startIndex, endIndex)
|
|
|
|
.replace(/"/g, '');
|
|
|
|
console.log(substring);
|
|
|
|
console.log(root.$store.getters[substring]);
|
|
|
|
console.log('loadFromStore');
|
|
|
|
title = computed(() => {
|
|
|
|
return root.$store.getters[substring];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return { realTitle: title };
|
|
|
|
}
|
2020-10-02 07:13:14 +00:00
|
|
|
});
|
|
|
|
</script>
|