一些项目要求数据更新,提出的需求就是更新数据,但要求就是其他组件不能进行刷新。
传统方案中是采用的是ajax。
我是一个技术小白,ajax不会。只是把js入门了。那么如何做这个呢?
刚开始我想的是用iframe,只刷新里面的一部分。但是效果并不理想。wex5是先渲染组件,再运行其代码。产生的效果就是wex5的其他组件加载完毕以后,再加载iframe里面的页面。
用过wex5的人或许对ScrollView 比较熟悉,官方的api文档就只有4个字来介绍 :滚动容器
这个下拉刷新效果可以达到更新数据,就像qq一样,下拉可以刷新数据。不过,这个下拉刷新会重新渲染数据组件。当你的请求发出去的时候,你屏幕上面的数据就会清空,等待服务器返回的数据。
当用户的设备网络ping过高时,就会产生几秒的没有数据的情况。 //谁知道用户怎么使用产品
The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the origin-based security model commonly used by web browsers. The protocol consists of an opening handshake followed by basic message framing, layered over TCP. The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g., using XMLHttpRequest or s and long polling)
对于我这种小白怎么可能短时间搞出这种东西呢?
功夫不负有心人,一不小心看到了一个帖子给了我灵感。
http://bbs.wex5.com/forum.php?mod=viewthread&tid=85274
只需要一行代码 this.comp("XID").refershData();就可以达到目的,完美解决问题。
赞过:
赞 正在加载……