|
楼主 |
发表于 2016-4-19 11:30:12
|
显示全部楼层
本帖最后由 hkdwolf 于 2016-4-19 12:44 编辑
我现在加了DATA组件,成功了。但是我抓包发现远程请求居然有4次!!帮忙分析下原因,谢谢!
-------network请求记录
http://localhost:8080/x5/UI2/v_8a94cbb64be74e8ba298496e641561a4l_zh_CNs_d_m/yjst/resadd.w?$pageType=view
http://localhost:8080/x5/UI2/v_8a94cbb64be74e8ba298496e641561a4l_zh_CNs_d_m/yjst/resadd.w?$pageType=model
(注:为什么会有2次请求)
http://www.111.com/yjst/resmgt.php?t=getstype
http://www.111.com/yjst/resmgt.php?t=getstype
http://www.111.com/yjst/resmgt.php?t=getstype
http://www.111.com/yjst/resmgt.php?t=getstype
(注:111.com是内部测试地址,居然有4次请求。。我试过将 bind-options="$model.getstype()" 去掉则1次请求都没有,说明4次都来自于bind-options, Why?)
-------DATA组件:
<div component="$UI/system/components/justep/data/data"
xid="stypeData"
idColumn="fID" autoLoad="true">
<column label="ID" name="sid" type="String" xid="xidsi
<column label="类型" name="sname" type="String" xid="xidsname"/>
<data xid="default12">
[{"sname":"优质产品","sid":"2"},{"sname":"主产品","sid":"3"},{"sname":"附加产品","sid":"4"}]
</data>
</div>
----select:
<select component="$UI/system/components/justep/select/select" xid="stype"
bind-ref="stypeData.ref('sid')" bind-labelRef="stypeData.ref('sname')" bind-optionsValue="sid" bind-optionsLabel="sname" bind-options="$model.getstype()"></select>
(注:一定要加component="$UI/system/components/justep/select/select"吗?不加会出现帖子主题的未定义错误)
-----JS:
Model.prototype.getstype = function(event){
var me=this;
var stype = "";
$.ajax({
"type" : "post",
"data":{
"uusid":123
},
"dataType" : "json",
"url" : "http://www.111.com/yjst/resmgt.php?t=getstype",
"success" : function(data) {
stype = data;
}
});
return stype;
};
|
|