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

UserSearch.jsx界面切换field选择,怎么清空keyword的值? #77

Closed
bjwulin opened this issue Sep 12, 2016 · 10 comments
Closed

Comments

@bjwulin
Copy link

bjwulin commented Sep 12, 2016

因为切换了field,那么应该把上一次填入的值即keyword的值清除掉?

是不是只能在切换的时候,通过onChangeField将model里面的状态改变来刷新UserSearch?

我还想根据field来更改keyword是输入框,还是下拉选择,或者日期范围...有没有其他更好的办法?

@sorrycc
Copy link
Member

sorrycc commented Sep 12, 2016

感觉这个地方用 component state 会比较合适。

@bjwulin
Copy link
Author

bjwulin commented Sep 12, 2016

好的,我试试。

@WhatAKitty
Copy link

@sorrycc 是不是建议,如果只是单纯的本组件内部状态,直接使用component state?现在配套使用了antd,类似form,就直接通过form.create存储在component state里面,不过其他的状态还是通过redux

@sorrycc
Copy link
Member

sorrycc commented Sep 13, 2016

@WhatAKitty 是的。

@sorrycc sorrycc closed this as completed Sep 13, 2016
@wonyun
Copy link

wonyun commented Sep 29, 2016

@sorrycc
看了你的答复,我又来疑问了,您说单纯本组件内部状态使用component state,那么单纯列表页中的列表数据和分页相关数据是否也可以置于component state而不用置于model的state中啊?如何更好的区分state该置于model中还是component中的情况呢?

@sorrycc
Copy link
Member

sorrycc commented Sep 29, 2016

推荐全部放 model 里。

@WhatAKitty
Copy link

@sorrycc 这里有一个问题,如果全部放在model内部,会不会造成state树过于庞大,APP运行不流畅?我在用的过程中有时候会出现这种情况。还是说,对于复杂的业务系统,不推荐使用redux?

@sorrycc
Copy link
Member

sorrycc commented Sep 30, 2016

还没遇到过这样的情况,再说担心 state 过大,可以通过 reducer 清理不需要的 state 。

@WhatAKitty
Copy link

@sorrycc 清理的话,是使用全局清理还是说在需要的时候进行清理一下对应的model,如果是按需清理的话,这样会不会造成代码复杂度提升,增大开发工作量?

@WhatAKitty
Copy link

reduxjs/redux#1287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants