fix require photo event

This commit is contained in:
Timi
2026-08-30 01:25:10 +08:00
parent 320dab542a
commit e1a3df43a9
5 changed files with 189 additions and 32 deletions
+15 -1
View File
@@ -1,6 +1,10 @@
<template>
<div v-bind="$attrs" class="photo-scroller">
<div class="t-form__label" v-text="title" />
<div class="t-form__label" :class="{ required }">
<slot name="title">
<span v-text="title" />
</slot>
</div>
<div class="photo-shell" :class="{ 'without-add': !showAdd }">
<div class="items">
<div v-if="!displayPhotoList.length" class="empty" v-text="emptyText" />
@@ -157,6 +161,7 @@ interface Props {
loading?: boolean;
modelValue: string[];
photoItems?: readonly PhotoItem[];
required?: boolean;
showViewerActions?: boolean;
showAdd?: boolean;
showRemove?: boolean;
@@ -188,6 +193,7 @@ const props = withDefaults(defineProps<Props>(), {
editMode: false,
emptyText: "暂无照片",
loading: false,
required: false,
showAdd: true,
showRemove: true,
showViewerActions: true
@@ -412,6 +418,14 @@ function normalizePhotoItem(item: PhotoItem): PhotoItem {
}
}
.t-form__label {
&.required::before {
color: var(--td-error-color, #e34d59);
content: "*";
margin-right: .25rem;
}
}
.add-trigger {
--td-popover-padding: 0 .5rem;
width: 5.5rem;