Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:为Uploader增加onClickUpload回调属性 #659

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/vantui/src/uploader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import { Uploader } from '@antmjs/vantui'
| onAfterRead | - | _&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;event:&nbsp;ITouchEvent<br/>&nbsp;&nbsp;)&nbsp;=>&nbsp;any<br/>_ | - | `false` |
| onOversize | - | _&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;event:&nbsp;ITouchEvent<br/>&nbsp;&nbsp;)&nbsp;=>&nbsp;any<br/>_ | - | `false` |
| onClickPreview | - | _&nbsp;&nbsp;(data:&nbsp;any)&nbsp;=>&nbsp;any<br/>_ | - | `false` |
| onClickUpload | - | _&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;event:&nbsp;ITouchEvent<br/>&nbsp;&nbsp;)&nbsp;=>&nbsp;any<br/>_ | - | `false` |

### 样式变量

Expand Down
3 changes: 3 additions & 0 deletions packages/vantui/src/uploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function Uploader(props: UploaderProps) {
onAfterRead,
onOversize,
onClickPreview,
onClickUpload,
style,
className,
children,
Expand Down Expand Up @@ -140,6 +141,7 @@ export function Uploader(props: UploaderProps) {
const startUpload = useCallback(
(event: ITouchEvent) => {
if (disabled) return
onClickUpload?.(event)
chooseFile({
accept,
multiple,
Expand Down Expand Up @@ -169,6 +171,7 @@ export function Uploader(props: UploaderProps) {
maxCount,
multiple,
onError,
onClickUpload,
state.lists.length,
accept,
camera,
Expand Down
1 change: 1 addition & 0 deletions packages/vantui/types/uploader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface UploaderProps extends ViewProps {
onAfterRead?: (event: ITouchEvent) => any
onOversize?: (event: ITouchEvent) => any
onClickPreview?: (data: any) => any
onClickUpload?: (event: ITouchEvent) => any
}

declare const Uploader: FunctionComponent<UploaderProps>
Expand Down
Loading