返回两个整数相加...登陆

两个整数相加

关超2019-04-30 16:37:28212
<html>
    <head>
        <meta charset="utf-8">
        <title>侦听器</title>
        <script type="text/javascript" src="vue.js"></script>
    </head>


    <body>
            <div id="box">
                请输入数字1 <input type="text" v-model="num1">
                请输入数字2 <input type="text" v-model="num2">
                <h2>两数相加结果为:{{sum}}</h2>

            </div>



            <script type="text/javascript">
                new Vue({
                    el:"#box",

                    data:{
                        num1:"",
                        num2:""
                    },
                    computed:{
                        sum:function(){
                            return parseInt(this.num1)+parseInt(this.num2);
                        }
                    }
                })

            </script>
    </body>
</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送