node.js - 怎么在初始化的时候使得一个子组件不加载?
高洛峰
高洛峰 2017-04-17 14:54:51
0
1
510


如图,我有个页面,里面有一个table,table里有一个Modal,其中table里的数据是在打开页面初始化的时候直接通过请求来获取的,当我点击"指派专家"这个modal之后,table会把这列的id传给modal,然后modal再通过请求来获取数据(传入id),但是我一打开页面会直接执行2个请求

而不是先执行table请求,然后我点击了modal按钮之后再执行下一个,
我的问题出在了哪里?(ps.貌似react里有一个可以阻止子组件加载的事件,类似didComponent)

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
大家讲道理

I haven’t posted the code, so I will talk about my theoretical understanding. My idea is, don’t you want to prevent the loading event of the sub-component, and isn’t this behavior very strange? You should make the render of your sub-component only style out when render is used, but the request inside should be triggered only when user interaction occurs. It should be bound to render when onclick is used, etc. In terms of interactive behavior, requests should not be made directly during render.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template