瀏覽代碼

✨ 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 月之前
父節點
當前提交
80e26752e2
共有 1 個文件被更改,包括 3 次插入1 次删除
  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}