• day66


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>作业</title>
    </head>
    <body>
    <div id="app">
        <h1 class="text-center">学生成绩总分排名表</h1>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>姓名</th>
                <th>数学</th>
                <th>语文</th>
                <th>英语</th>
                <th>总分</th>
            </tr>
            </thead>
            <tbody>
    
            <tr v-for="dic in order_scores">
                <th>{{ dic['name'] }}</th>
                <th>{{ dic['math'] }}</th>
                <th>{{ dic['chinese'] }}</th>
                <th>{{ dic['english'] }}</th>
                <th>{{ dic['math']+dic['chinese']+dic['english'] }}</th>
            </tr>
            </tbody>
        </table>
    
    
        <h1 class="text-center">学生成绩及格表</h1>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>姓名</th>
                <th>数学</th>
                <th>语文</th>
                <th>英语</th>
                <th>总分</th>
            </tr>
            </thead>
            <tbody>
    
            <tr v-for="dic in pass_score">
                <th>{{ dic['name'] }}</th>
                <th>{{ dic['math'] }}</th>
                <th>{{ dic['chinese'] }}</th>
                <th>{{ dic['english'] }}</th>
                <th>{{ dic['math']+dic['chinese']+dic['english'] }}</th>
            </tr>
            </tbody>
        </table>
    
    
        <h1 class="text-center">学生成绩查询表</h1>
        <p>
            <button type="button" @click="subject('math')">数学</button>
            <button type="button" @click="subject('chinese')">语文</button>
            <button type="button" @click="subject('english')">英语</button>
        </p>
        <p>请输入分数
            <input type="number" v-model="start" min="0" max="100">~
            <input type="number" v-model="end" min="0" max="100">
        </p>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>姓名</th>
                <th :style="{backgroundColor: math}">数学</th>
                <th :style="{backgroundColor: chinese}">语文</th>
                <th :style="{backgroundColor: english}">英语</th>
                <th>总分</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="dic in scores">
                <th>{{ dic['name'] }}</th>
                <th :style="{backgroundColor: math}">{{ dic.math }}</th>
                <th :style="{backgroundColor: chinese}">{{ dic.chinese }}</th>
                <th :style="{backgroundColor: english}">{{ dic.english }}</th>
                <th>{{ dic['math']+dic['chinese']+dic['english'] }}</th>
            </tr>
            </tbody>
        </table>
    </div>
    </body>
    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                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},
                ],
    
                english: "",
                chinese: "",
                math: "",
    
                start: '',
                end: '',
    
                page: ''
    
    
            },
            methods: {
                subject(sub) {
                    if (sub === "math") {
                        this.math = "red";
                        this.english = '';
                        this.chinese = '';
                    } else if (sub === "english") {
                        this.english = "red";
                        this.math = "";
                        this.chinese = "";
                    } else {
                        this.math = '';
                        this.english = '';
                        this.chinese = "red";
                    }
    
                }
            },
            computed: {
                order_scores: function () {
                    let arr = this.scores;
    
                    for (let i = 0; i < arr.length; i++) {
                        for (let j = 0; j < arr.length - 1; j++) {
                            let sum1 = arr[j].math + arr[j].chinese + arr[j].english;
                            let sum2 = arr[j + 1].math + arr[j + 1].chinese + arr[j + 1].english;
                            if (sum1 < sum2) {
                                let temp = arr[j + 1];
                                arr[j + 1] = arr[j];
                                arr[j] = temp;
                            }
                        }
                    }
                    return arr
                },
    
                pass_score: function () {
                    let arr = this.scores;
                    let arr1 = [];
                    for (let i = 0; i < arr.length; i++) {
                        if (arr[i].math >= 60 && arr[i].chinese >= 60 && arr[i].english >= 60) {
                            arr1[i] = arr[i]
                        }
                    }
    
                    return arr1
                },
            }
    
    
        })
    </script>
    </html>
    
  • 相关阅读:
    halcon应用案例探究
    Halcon中模板匹配方法的总结归纳
    halcon开发必读
    全局Threshold和动态阈值分割Dyn_Threshold的应用场景
    halcon电路断裂检测
    halcon之 distance_transform
    VS调试不能进入断点,提示当前不会命中断点还未为文档加载任何符号
    .net reactor使用教程(一)——界面各功能说明(转)
    (转) 开运算opening_circle和闭运算closing_circle的异同
    Win10系统安装UEFI+GPT配置
  • 原文地址:https://www.cnblogs.com/xwjhyy/p/12057954.html
Copyright © 2020-2023  润新知