#51 feat: logo del sitio editable desde el panel de administración
This commit is contained in:
39
src/components/SiteLogo.vue
Normal file
39
src/components/SiteLogo.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user