zoukankan      html  css  js  c++  java
  • day66

    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 },
    ]
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    <div id="app">
        <table>
            <tr>
                <th>排名</th>
                <th>姓名</th>
                <th>数学</th>
                <th>语文</th>
                <th>英语</th>
                <th>总分</th>
            </tr>
            <tr v-for="(st,i) in scores">
                <td>{{ i+1 }}</td>
                <td v-for="v in st">{{ v }}</td>
            </tr>
        </table>
    </div>
    </body>
    <script src="vue/vue.min.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_score = [];
        scores.forEach((st)=>{
            st.total = st.math + st.chinese + st.english;
            total_score.push(st);
        });
    
        for (let i = 0; i < total_score.length - 1; i++) {
            for (let j = 0; j < total_score.length - 1 - i; j++) {
                if (total_score[j].total > total_score[j + 1].total) {
                    temp = total_score[j];
                    total_score[j] = total_score[j + 1];
                    total_score[j + 1] = temp;
    
                }
            }
        }
    
    </script>
    <script>
        new Vue({
            el: '#app',
            data: {
                scores: total_score
            }
        })
    </script>
    </html>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    <div id="app">
        <table>
            <tr>
                <th>排名</th>
                <th>姓名</th>
                <th>数学</th>
                <th>语文</th>
                <th>英语</th>
                <th>总分</th>
            </tr>
            <tr v-for="(st,i) in scores" v-if="st.math > 60 & st.chinese > 60 & st.english > 60">
                <td>{{ i+1 }}</td>
                <td v-for="v in st">{{ v }}</td>
            </tr>
        </table>
    </div>
    </body>
    <script src="vue/vue.min.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_score = [];
        scores.forEach((st) => {
            st.total = st.math + st.chinese + st.english;
            total_score.push(st);
        });
    
        for (let i = 0; i < total_score.length - 1; i++) {
            for (let j = 0; j < total_score.length - 1 - i; j++) {
                if (total_score[j].total > total_score[j + 1].total) {
                    temp = total_score[j];
                    total_score[j] = total_score[j + 1];
                    total_score[j + 1] = temp;
    
                }
            }
        }
    
    </script>
    <script>
        new Vue({
            el: '#app',
            data: {
                scores: total_score
            }
        })
    </script>
    </html>
    

  • 相关阅读:
    PAT 1020 月饼 (25)(精简版代码+思路+推荐测试用例)
    PAT 1010 一元多项式求导 (25)(STL-map+思路)
    通过无线连接的方式来做 Appium 自动化
    Eclipse shift + ctrl + F 不好用
    Appium 出现 > error: com.test/.activity1 never started. Current: com.test/.activity2
    Appium 出现 > error: com.test/.activity1 never started. Current: com.test/.activity2
    从CSDN 来到博客园入驻——2015/1/28
    敏捷自动化测试(1)—— 我们的测试为什么不够敏捷?
    敏捷自动化测试(2)——像用户使用软件一样享受自动化测试
    Android自动化测试之Monkey工具
  • 原文地址:https://www.cnblogs.com/setcreed/p/12057149.html
Copyright © 2011-2022 走看看