For instance, let's say this.last
is 5 and this.current
is 60. I want the sum of this.last
+ this.current
to be 65, not 605. I attempted using
parseInt(this.last + this.current)
but it did not work as expected.
<button class="plus" @click="plus">+</button>
<input class="res" v-model="current" maxlength="24" disabled>
<input class="res2" v-model="last" maxlength="24" disabled>
button{
width:200px;
height:200px;
}
data:{
last: null,
current: " ",
plusClicked: false
}
methods:{
plus:function(){
this.last = this.current;
this.current = " ";
this.plusClicked = true;
},
equal:function(){
if(this.plusClicked == true){
alert(parseInt(this.last + this.current));
this.plusClicked = !true;
}
}},