我已经在其他页面找到了这个问题和解决方案,但我仍然无法获得一个完美的解决方案。
我正在遍历一个包含200个对象的数组。
var stringBuffer = [];
for(var i = 0; i < array; i++) {
stringBuffer.push('<input type="radio" class="select_options" data-iconpos="right" onClick ="callClosePopup(event);" name="items" id="radio_' + array[i].ConditionId + '" ' + checked + 'value="' + array[i].ConditionId+'_' + array[i].Description + '"/><label data-corners="false" data-iconshadow="false" style="border-bottom:1px solid rgb(0,0,0)" for="radio_' + array[i].ConditionId + '">' + array[i].Description + '</label>');
}
var combinedHtml = stringBuffer.join("")
$("#myListView").html(combinedHtml).trigger("create"); <=== This line consumes a lot of time (around 9 seconds on my Moto G).
有什么想法可以改进这一点吗?
PS:我使用的是jQuerymobile v-1.3.1。
https://stackoverflow.com/questions/38221755
复制