I am try add 1, but item.num
is 01. How to add 1 input value is 1,2,3,4,5...? Note that num
must be the string. Go the demo of jsfiddle.
Look at the gif:
Look at the image:
Note:item.num += 1
do not need to modify!
I want the following effect:
Look at the javascript:
var app = new Vue({
el: "#app",
data: {
list: [{
id: "1",
name: "demo01",
num: "0"
}],
addnum: []
},
methods: {
addClick(item) {
console.log(this.addnum.push(item))
item.num+=1
},
}
})
HTML file:
<div id="app">
<ul>
<li v-for="item in list">
<p>{{item.name}}</p>
<br>
<input type="text" :value="item.num">
<button @click="addClick(item)">+</button>
</li>
</ul>
</div>