Ver código fonte

✨ feat(avatar): add custom upload button text for AvatarSelector

- add uploadButtonText prop with default value '上传'
- allow customizing the text of the upload button through props
yourname 2 meses atrás
pai
commit
80e26752e2
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      src/client/admin/components/AvatarSelector.tsx

+ 3 - 1
src/client/admin/components/AvatarSelector.tsx

@@ -19,6 +19,7 @@ interface AvatarSelectorProps {
   accept?: string;
   maxSize?: number;
   uploadPath?: string;
+  uploadButtonText?: string;
   previewSize?: 'small' | 'medium' | 'large';
   showPreview?: boolean;
   placeholder?: string;
@@ -30,6 +31,7 @@ const AvatarSelector: React.FC<AvatarSelectorProps> = ({
   accept = 'image/*',
   maxSize = 2,
   uploadPath = '/avatars',
+  uploadButtonText = '上传',
   previewSize = 'medium',
   showPreview = true,
   placeholder = '选择头像',
@@ -218,7 +220,7 @@ const AvatarSelector: React.FC<AvatarSelectorProps> = ({
                           accept={accept}
                           maxSize={maxSize}
                           onUploadSuccess={handleUploadSuccess}
-                          buttonText="上传"
+                          buttonText={uploadButtonText}
                           size="minimal"
                           displayMode="card"
                           showUploadList={false}