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 : input-text选择器模式时增加触发change事件 #9301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions packages/amis/src/renderers/Form/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,25 @@ export default class TextControl extends React.PureComponent<
}
}

handleChange(value: any) {
async handleChange(value: any) {
const {
onChange,
multiple,
options,
selectedOptions,
creatable,
valueField
valueField,
dispatchEvent
} = this.props;

const rendererEvent = await dispatchEvent(
'change',
resolveEventData(this.props, {value})
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里派发的value有问题,应该是处理之后的value,也即onChange抛出的value

);
if (rendererEvent?.prevented) {
return;
}

// Downshift传入的selectedItem是valueField字段,需要取回选项
const toggledOption = options.find(
item => item[valueField || 'value'] === value
Expand Down
Loading