vue里面点击加号增加一行(如图)功能怎么写?求解

https://img2.mukewang.com/5c480e0c0001229107430114.jpg

vue里面点击加号增加一行(如图)功能怎么写?求解

喵喔喔
浏览 3993回答 1
1回答

慕运维8079593

<div v-for="(v,i) in list">&nbsp; &nbsp; <input v-model="list[i].a"></input>&nbsp; &nbsp; <input v-model="list[i].b"></input></div>data () {&nbsp; &nbsp; list: [&nbsp; &nbsp; &nbsp; &nbsp; {a: '', b: ''},&nbsp; &nbsp; &nbsp; &nbsp; {a: '', b: ''}&nbsp; &nbsp; }},methods: {&nbsp; &nbsp; AddList () {&nbsp; &nbsp; &nbsp; &nbsp; this.list.push({a: '', b: ''})&nbsp; &nbsp; }}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript