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

[FR]: 希望 Pickercolumns 能接受空数组 #2590

Closed
ieu opened this issue Oct 9, 2023 · 0 comments · Fixed by #2611
Closed

[FR]: 希望 Pickercolumns 能接受空数组 #2590

ieu opened this issue Oct 9, 2023 · 0 comments · Fixed by #2611
Labels
Feature Request 新功能请求

Comments

@ieu
Copy link

ieu commented Oct 9, 2023

这个功能解决了什么问题?

如下示例,当我们希望给 Picker 添加关键词过滤功能时,目前 Picker 不能通过显然的方式实现,因为 columns 不允许为空

<script setup>
import {ref} from 'vue';

const columns = ref([
  {text: '南京', value: 'NanJing'},
  {text: '无锡', value: 'WuXi'},
  {text: '海北', value: 'ZangZu'},
  {text: '北京', value: 'BeiJing'},
  {text: '连云港', value: 'LianYunGang'},
  {text: '浙江', value: 'ZheJiang'},
  {text: '江苏', value: 'JiangSu'}
]);

const filteredColumns = ref(columns.value)

const search = query => {
  filteredColumns.value = columns.value.filter(column => column.text.includes(query));
}

</script>

<template>
  <nut-picker :columns="filteredColumns" title="城市选择">
    <template #top>
      <nut-searchbar @change="search"></nut-searchbar>
    </template>
  </nut-picker>
</template>

你期望的组件设计是怎样的?

既然 columns 默认为空,我认为可以放开 columns 限制,使其接受空数组。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request 新功能请求
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant