1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Vue前端框架练习</title> <script src="./前端框架/vue.js"></script> </head> <body> <div id="app"> <table border="1" align="center" cellspacing="0" width="60%"> <tr> <th>编号</th> <th>姓名</th> <th>年龄</th> <th>性别</th> <th>成绩</th> <th>等级</th> </tr> <tr v-for="(item,index) in user" > <td>{{index+1}}</td> <td>{{item.name}}</td> <td>{{item.age}}</td> <td v-if="item.gender==1">男</td> <td v-else>女</td> <td>{{item.score}}</td> <td v-if="item.score>80">优秀</td> <td v-else>及格</td> </tr> </table> </div> </body> <script> new Vue({ el:"#app", data: { user:[{ name :"Tom", age:20, gender: 1, score:78 },{ name :"Rose", age:18, gender: 2, score:98 },{ name :"Jerry", age:26, gender: 2, score:77 }] }, }) </script> </html>
|