Files
imen_pishghaman/apps/admin/src/components/ImageRefField.vue
T

22 lines
801 B
Vue
Raw Normal View History

<script setup lang="ts">
import type { ImageRef } from "@imen/shared";
import FormField from "./FormField.vue";
import ImageField from "./ImageField.vue";
/** Edits an { url, alt } image stored inside section content */
const image = defineModel<ImageRef>({ required: true });
defineProps<{ path: string; label: string }>();
</script>
<template>
<FormField :path="`${path}.url`" :label="label" required>
<ImageField
:url="image.url"
@pick="(m) => (image = { url: m.url, alt: image.alt || m.alt })"
/>
</FormField>
<FormField :path="`${path}.alt`" label="متن جایگزین تصویر (alt)" hint="برای سئو و دسترسی‌پذیری؛ تصویر را در یک جمله توصیف کنید">
<a-input v-model:value="image.alt" />
</FormField>
</template>