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

chore:(amis) 给input-image 组件添加select动作,其他组件可以触发他的选择文件 #9214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions docs/zh-CN/components/form/input-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ app.listen(8080, function () {});

当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。

| 动作名称 | 动作配置 | 说明 |
| -------- | -------- | ---- |
| clear | - | 清空 |
| 动作名称 | 动作配置 | 说明 |
|--------| -------- |--------|
| clear | - | 清空 |
| select | - | 打开选择图片 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

补下单测

5 changes: 5 additions & 0 deletions packages/amis/src/renderers/Form/InputImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,11 @@ export default class ImageControl extends React.Component<
this.files = [];
onChange('');
}

// @ts-ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

补下ts

if (action.actionType === 'select') {
this.handleSelect();
}
}

// 重新上传
Expand Down
Loading