Files
don_confiao_frontend/src/components/SiteLogo.vue

40 lines
724 B
Vue

<template>
<v-img
v-if="logoUrl && !broken"
:src="logoUrl"
:alt="alt"
:max-width="maxWidth"
@error="broken = true"
/>
</template>
<script setup>
import { computed, inject, onMounted, ref } from 'vue';
import { useSettingsStore } from '@/stores/settings';
const props = defineProps({
maxWidth: {
type: [Number, String],
default: 180,
},
alt: {
type: String,
default: 'Don Confiao',
},
});
const settingsStore = useSettingsStore();
const api = inject('api');
const broken = ref(false);
const logoUrl = computed(() => settingsStore.logo);
onMounted(async () => {
try {
await settingsStore.fetchSettings(api);
} catch (e) {
broken.value = true;
}
});
</script>