Skip to content

AutoComplete 的设计问题 #166

@MatteoSwift

Description

@MatteoSwift

AutoComplete 的默认内容插槽

<slot>
  <i-option v-for="item in filteredData" :value="item" :key="item">{{ item }}</i-option>
</slot>

问题:

i-option 插槽用来显示内容项,这一个点并不友好,它是你这个控件的基本功能,别忘了你还有一个计算函数filteredData呢,这个filteredData内部调用了props.filterMethod。如果外部使用时,自定义了这个插槽,你的filterMethod就失效了。

建议:

<i-option v-for="item in filteredData" :value="item" :key="item"><template #item>{{ item }}</template></i-option>

如果不改实现,那么就请在文档里指出自定义显示会导致filter-method失效!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions