Comparison and Application of JS template engine BaiduTemplate and ArtTemplate
Recently, I used the JS template engine to render HTML. The JS template engine was known to be used for projects last year, but it has never been used. It only stays at the level of understanding, it was not used until this project was completed. The JS template engine used two baidutemplates and ArtTemplate. The BaiduTemplate engine was used at the beginning of the project. After the project was completed, it was released to the Internet. When it was found that the loading speed was slow due to a large amount of data, it was considered whether another template engine could improve the rendering efficiency, after searching and comparing on the internet, I found that ArtTemplate is better, so I learned a little more about it. The syntax of the two engines is a little different, but the result is as follows, the following describes how to use two engines: BaiduTemplate Code introduces the copy Code <script type = "text/javascript"> var html; var bt = baidu. template; $ (function () {$. ajax ({type: "GET", url: "/Json/Analysis. js ", dataType: 'json', success: function (data) {html = bt ('t: Jtlm_Analysis ', {list: data}); document. GetElementById ('jtlm _ analytic '). innerHTML = html ;}}) ;}); </script> copy a custom code template and copy the Code <script id = "t: jtlm_Analysis "type =" text/html "> <% for (var I = 0; I <list. length; I ++) {%> <div class = "widget-box transparent collapsed"> <div class = "widget-header-flat">