zoukankan      html  css  js  c++  java
  • Vue12.17作业

    """
    1、先有一下成绩单数据
    scores = [
    	{ name: 'Bob', math: 97, chinese: 89, english: 67 },
    	{ name: 'Tom', math: 67, chinese: 52, english: 98 },
    	{ name: 'Jerry', math: 72, chinese: 87, english: 89 },
    	{ name: 'Ben', math: 92, chinese: 87, english: 59 },
    	{ name: 'Chan', math: 47, chinese: 85, english: 92 },
    ]
    用table表格标签渲染以上数据,表格第一列是学生总分排名,最后一列是学生总分;
    
    2、还是采用上方相同的数据,采用相同的渲染规则,只渲染所有科目都及格了的学生。
    """
    

    <!DOCTYPE html>
    <html lang="zh">
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div id="app">
            <table border="1" width="400" rules="all" style="margin: auto">
                <tr>
                    <th>排名</th>
                    <th>姓名</th>
                    <th>数学</th>
                    <th>语文</th>
                    <th>英语</th>
                    <th>总分</th>
                </tr>
                <tr v-for="(stu,i) in scores">
                    <td>{{ i + 1 }}</td>
                    <td v-for="v in stu">{{ v }}</td>
                </tr>
            </table>
        </div>
    </body>
    <script src="js/vue.js"></script>
    <script>
        let scores = [
            {name: 'Bob', math: 97, chinese: 89, english: 67},
            {name: 'Tom', math: 67, chinese: 52, english: 98},
            {name: 'Jerry', math: 72, chinese: 87, english: 89},
            {name: 'Ben', math: 92, chinese: 87, english: 59},
            {name: 'Chan', math: 47, chinese: 85, english: 92},
        ];
    
        let total_scores = [];
        for (stu of scores) {
            stu.total = stu.math + stu.chinese + stu.english;
            total_scores.push(stu);
        }
    
        // scores = [
        //     {name: 'Bob', math: 97, chinese: 89, english: 67, total:total},
        //     {name: 'Tom', math: 67, chinese: 52, english: 98, total:total},
        //     {name: 'Jerry', math: 72, chinese: 87, english: 89, total:total},
        //     {name: 'Ben', math: 92, chinese: 87, english: 59, total:total},
        //     {name: 'Chan', math: 47, chinese: 85, english: 92,total:total},
        // ]
    
        for(let i = 0; i < total_scores.length - 1; i++) {
            for(let j = 0;  j < total_scores.length - 1 - i; j++) {
                if (total_scores[j].total < total_scores[j+1].total) {
                    let t = total_scores[j];
                    total_scores[j] = total_scores[j+1];
                    total_scores[j+1] = t;
                }
            }
        }
    
        new Vue({
            el: '#app',
            data: {
                scores: total_scores,
            }
        });
    </script>
    </html>
    

    <!DOCTYPE html>
    <html lang="zh">
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div id="app">
            <table border="1" width="400" rules="all" style="margin: auto">
                <tr>
                    <th>排名</th>
                    <th>姓名</th>
                    <th>数学</th>
                    <th>语文</th>
                    <th>英语</th>
                    <th>总分</th>
                </tr>
                <tr v-for="(stu,i) in scores" v-if="stu.math>=60 && stu.chinese>=60 && stu.english>=60">
                    <td>{{ i + 1 }}</td>
                    <td v-for="v in stu">{{ v }}</td>
                </tr>
            </table>
        </div>
    </body>
    <script src="js/vue.js"></script>
    <script>
        let scores = [
            {name: 'Bob', math: 97, chinese: 89, english: 67},
            {name: 'Tom', math: 67, chinese: 52, english: 98},
            {name: 'Jerry', math: 72, chinese: 87, english: 89},
            {name: 'Ben', math: 92, chinese: 87, english: 59},
            {name: 'Chan', math: 47, chinese: 85, english: 92},
        ];
    
        let total_scores = [];
        for (stu of scores) {
            stu.total = stu.math + stu.chinese + stu.english;
            total_scores.push(stu);
        }
    
        // scores = [
        //     {name: 'Bob', math: 97, chinese: 89, english: 67, total:total},
        //     {name: 'Tom', math: 67, chinese: 52, english: 98, total:total},
        //     {name: 'Jerry', math: 72, chinese: 87, english: 89, total:total},
        //     {name: 'Ben', math: 92, chinese: 87, english: 59, total:total},
        //     {name: 'Chan', math: 47, chinese: 85, english: 92,total:total},
        // ]
    
        for(let i = 0; i < total_scores.length - 1; i++) {
            for(let j = 0;  j < total_scores.length - 1 - i; j++) {
                if (total_scores[j].total < total_scores[j+1].total) {
                    let t = total_scores[j];
                    total_scores[j] = total_scores[j+1];
                    total_scores[j+1] = t;
                }
            }
        }
    
        new Vue({
            el: '#app',
            data: {
                scores: total_scores,
            }
        });
    </script>
    </html>
    
  • 相关阅读:
    关于白盒测试的心得
    基于Java的闰年测试
    等价类划分练习的代码实现
    软件测试中的等价类划分练习
    关于软件测试的初学小结
    现代软件工程作业第十二题(原十四题)
    好像木有白盒测试实验的报告,补一个~
    给大家推荐一本书啊啊~
    关于【做一名软件测试工程师,需要具备什么】的我的看法
    关于考试的笔记整理
  • 原文地址:https://www.cnblogs.com/maqiaobin/p/12056392.html
Copyright © 2011-2022 走看看