写了一个动态的<input> 将数组绑定到<input>
如
inputList = []
<input v-for="item in inputList" v-model="item" />
展示用的input可以增加但是展示《input》改变的时候list中的内容不会改变

在https://segmentfault.com/q/1010000010718798/a-1020000010719502
的回答中,找到了方法
<input v-for="(item, index) in inputList" v-model="inputList[index]">{{item}}</input>
这样就实现了input与list的双向绑定

网友评论