requirej入门nodeTpl 例子(四)
模板部分
1 <template name="main"> 2 <? for(var i=0 ;i <@assessment_list.length;i++) { ?> 3 <p class="bStyle"><?=@assessment_list[i].assessment_name ?></p> 4 <?}?> 5 </template>
HTML部分
1 <!DOCTYPE html> 2 <html> 3 <head lang="en"> 4 <meta charset="UTF-8"> 5 <title></title> 6 <script data-main="../js/requireConfig" src="../js/require.js?v=33"></script> 7 <style> 8 .bStyle{ 9 border:1px solid red;padding: 10px 10 } 11 </style> 12 </head> 13 <body> 14 <input type="button" class="sendReq" value="发送请求"> 15 <div class="container"> 16 </div> 17 <script> 18 require(['../js/index.js?=332']); 19 </script> 20 </body> 21 </html>
JS 部分