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

Select选择器的使用 #37

Closed
1 task
loliconer opened this issue Jun 14, 2018 · 7 comments
Closed
1 task

Select选择器的使用 #37

loliconer opened this issue Jun 14, 2018 · 7 comments

Comments

@loliconer
Copy link

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

描述

现在的select选择器使用起来感觉有点冗余,是否可以简化一下?

现在

<a-select v-model="value">
    <a-select-option v-for="option of options"
        :value="option.value" :key="option.value">{{option.label}}</a-select-option>
</a-select>

可以这样?

<a-select v-model="value" :data-source="options"></a-select>

What is actually happening?

...


...

@tangjinzhou
Copy link
Member

👌 后期会考虑,你也可以给我们提pr

@jasonc08
Copy link

jasonc08 commented Jun 16, 2018

如果用了你简化了的版本,我怎样才可以改变select-option里面的内容
现在的是比较好,一看便了解怎样用
:datasource 当你看见时,其实不知怎样用,要看doc才会了解
a-select-option 根本就是select里的option,一看便懂了

@loliconer
Copy link
Author

loliconer commented Jun 20, 2018

@jasonc08

  1. 你为什么需要改变option里的内容?其实对于使用者来说并不关心option部分;
  2. 每个组件都需要看doc的,这里只要约定好value和label两个属性即可,就像table的数据约定了title和dataIndex;
  3. doc只需看一次,一劳永逸,你这样每次都得多写这么多代码,不够简洁

@tangjinzhou 不好意思啊,对jsx语法不是很熟悉,看了下源码,select组件的代码结构有点复杂,不知道怎么下手[捂脸]。只是建议,还好并不影响使用。

@chenchi2038
Copy link

感觉现在的写法更加灵活,也方便订制。

@tangjinzhou
Copy link
Member

后续两种方式均会保留并且dataSource拥有更高的优先级,如需要灵活性可继续使用a-select-option

@tangjinzhou
Copy link
Member

@lock
Copy link

lock bot commented Jul 11, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants