Skip to content

Commit

Permalink
fix(useimage): fix useImage choose function params partial
Browse files Browse the repository at this point in the history
  • Loading branch information
innocces committed Sep 28, 2021
1 parent 46cdafb commit cf7be5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/hooks/src/useImage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const [

| 返回值 | 说明 | 类型 |
| ----------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| choose | 选择图片 | `(option: ChooseImageOption) => Promise<chooseImage.SuccessCallbackResult>` |
| choose | 选择图片 | `(option?: ChooseImageOption) => Promise<chooseImage.SuccessCallbackResult>` |
| chooseMessageFile | 选择会话资源 | `(count: number,type?: Pick<chooseMessageFile.Option, 'type'>,extend?: Pick<chooseMessageFileOption, 'extension'>) => Promise<chooseMessageFile.SuccessCallbackResult>` |
| preview | 预览图片 | `(option: PreviewImageOption) => Promise<General.CallbackResult>` |
| save | 保存图片(h5 支持) | `(filePath: string) => Promise<General.CallbackResult>` |
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/src/useImage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type ChooseImageOption = Partial<
export type PreviewImageOption = Pick<previewImage.Option, 'current' | 'urls'>;

export type ChooseImageAction = (
option: ChooseImageOption,
option?: ChooseImageOption,
) => Promise<chooseImage.SuccessCallbackResult>;

export type PreviewImageAction = (
Expand Down Expand Up @@ -63,7 +63,7 @@ function useImage(options: ChooseImageOption): [IFileInfo, IAction] {
const [fileInfo, setFileInfo] = useState<IFileInfo>({});
const env = useEnv();

const chooseImageAsync = useCallback<ChooseImageAction>((option) => {
const chooseImageAsync = useCallback<ChooseImageAction>((option = {}) => {
const { count, sizeType, sourceType } = options;
const finalOptions = Object.assign(
{},
Expand Down

2 comments on commit cf7be5f

@vercel
Copy link

@vercel vercel bot commented on cf7be5f Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

taro-hooks-h5 – ./

taro-hooks-h5-innocces.vercel.app
taro-hooks-h5-green.vercel.app
taro-hooks-h5-git-main-innocces.vercel.app

@vercel
Copy link

@vercel vercel bot commented on cf7be5f Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

taro-hooks – ./

taro-hooks-git-main-innocces.vercel.app
taro-hooks-innocces.vercel.app
taro-hooks-theta.vercel.app

Please sign in to comment.