zoukankan      html  css  js  c++  java
  • Vue之趣味乘法表

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>九九乘法表</title>
        <!-- development version, includes helpful console warnings -->
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    
    </head>
    <body>
        <div id="app">
            <h3>九九乘法表</h3>
            <input type="text" v-model="num">
            <span>请输入数字</span>
            <button @click="add" :disabled="addFlag">add</button>
            <button @click="reduce" :disabled="reduceFlag">reduce</button>
    
            <table border="1">
            <tr v-for="i in parseInt(num)">
                <td style="100px;" v-for="j in i"> 
                    {{j}}*{{i}}={{j*i}}
                </td>
            </div>
        </table>
        </div>
    </body>
    <script>
    var app = new Vue({
        el:'#app',
        data:{
            num:9,
            addFlag:false,
            reduceFlag:false
        },
        methods:{
            add:function(){
                if(this.num==9){
                   this.addFlag=true;
                }else{
                    this.reduceFlag=false;
                    this.num++;
                }
            },
            reduce:function(){
                if(this.num==1){
                   this.reduceFlag=true;
                }else{
                    this.addFlag=false;
                    this.num--;
                }
            }
        }
    })
    </script>
    </html>
  • 相关阅读:
    第03组 Alpha冲刺 (4/6)
    第03组 Alpha冲刺 (3/6)
    第03组 Alpha冲刺 (2/6)
    第03组 Alpha冲刺 (1/6)
    第03组(63) 需求分析报告
    第3组(63) 团队展示
    结对编程作业
    第03组 Alpha冲刺 总结
    第03组 Alpha冲刺 (6/6)
    第03组 Alpha冲刺 (5/6)
  • 原文地址:https://www.cnblogs.com/lin137/p/11907781.html
Copyright © 2011-2022 走看看