ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

AutoComplete 自动完成-自定义选项 为什么设计成选择完选项回填到输入框时,自动前后加空格?

Open pl2476 opened this issue 4 years ago • 3 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.7.2

Environment

browser version:87.0.4280.141

Reproduction link

https://antdv.com/components/auto-complete-cn/

Steps to reproduce

直接在文档网站即可操作出来 1、选择AutoComplete代码演示 2、查看自定义选项例子 3、输入1 4、选择下拉”[email protected]“ 5、得出输入框结果” [email protected]

What is expected?

[email protected]

What is actually happening?

[email protected]


这样的话,如果用户想删除某些字符,得先删除一些空格,操作不太友好

pl2476 avatar Jan 28 '21 07:01 pl2476

  <a-auto-complete
    style="width: 200px"
    placeholder="input here"
    option-label-prop="title"
  >
    <template slot="dataSource">
      <a-select-option v-for="email in result" :key="email" :title="email">
        {{ email }}
      </a-select-option>
    </template>
  </a-auto-complete>
</template>

这样规避一下吧

zkwolf avatar Jan 29 '21 06:01 zkwolf

谢谢 之前暂时这么处理了

pl2476 avatar Feb 06 '21 03:02 pl2476

  <a-auto-complete
    style="width: 200px"
    placeholder="input here"
    option-label-prop="title"
  >
    <template slot="dataSource">
      <a-select-option v-for="email in result" :key="email" :title="email">
        {{ email }}
      </a-select-option>
    </template>
  </a-auto-complete>
</template>

这样规避一下吧

试过了没有用,1.7.8 的版本,想请教下为什么这个要加 title,而不是 label 呢,label 也试过了不行。

cooper1x avatar Jun 04 '24 02:06 cooper1x