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

input-text组件使用autoComplete属性时 点击了选项 选项组弹框不消失 需要点击空白处才能消失 #8173

Open
Liary0 opened this issue Sep 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Liary0
Copy link

Liary0 commented Sep 19, 2023

描述问题:

input-text组件使用autoComplete属性时 点击了选项 选项组弹框不消失 需要点击空白处才能消失

截图或视频:

b8f75afe866e9f0bc3b56f321255077

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的?
    sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    https://img.7ugame.cn/amis/sdk.js

  3. 粘贴有问题的完整 amis schema 代码:

{
                            "type": "input-text",
                            "name": "label",
                            "label": "游戏名称",
                            "required": true,
                            "autoComplete": "post:/admin/game/searchGame",
                            "autoFill": {
                                "FDeviceCode": "${FDeviceCode}",
                                "FRelationCode": "${FGameCode}"
                            },
                            "visibleOn": "${FRelationType == 2}"
                        },
  1. 操作步骤
    请简单描述一下复现的操作步骤...
@allenve allenve self-assigned this Sep 20, 2023
@allenve allenve added bug Something isn't working and removed need confirm labels Sep 20, 2023
@lhtuling
Copy link

我大概找到问题所在,也本地测试修复了, 但是不知道有没有其他影响,代码应该也不算太规范,但是解决这个问题了
修改这个文件
packages\amis\src\renderers\Form\InputText.tsx
里面的


  async handleClick(event: React.MouseEvent) {
    const {dispatchEvent, value, multiple} = this.props;
    const rendererEvent = await dispatchEvent(
      'click',
      resolveEventData(this.props, {
        value
      })
    );

    if (rendererEvent?.prevented) {
      return;
    }
    // 已经 focus 的就不重复执行,否则总重新定位光标
    this.state.isFocused || this.focus();
    if(multiple ||(event.target as HTMLElement).tagName.toLowerCase() === 'input'){
      this.setState({
        isOpen: true
      });
    }
  }

整个替换掉就行了

提交个pr看看能过不能
#10972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants