用vuejs实现简单点的加法计算器

Original 2019-06-07 17:19:56 478
abstract:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>计算器</title></head><div id="box"><div><input typ

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>计算器</title>

</head>

<div id="box">

<div>

<input type="text" v-model="number1">

+

<input type="text" v-model="number2">

<input type="button" v-on:click="count" value="=" name="">

<button @click="count">....</button>

<span>{{And}}</span>

<h3>{{number1}}</h3>

<h3>{{number2}}</h3>

</div>

</div>

<body>

<script src="js/Vue.js"></script>

<script>

new Vue({

el:"#box",

data:{

And:"",

number1:"0",

number2:"0"

},

methods:{

count:function(){

this.And=(this.number1-0)+(this.number2-0)

}

}

})

</script>



</body>

</html>


Correcting teacher:查无此人Correction time:2019-06-10 09:43:04
Teacher's summary:完成的不错,下次把代码缩进对齐,继续加油

Release Notes

Popular Entries