[b][size=medium][color=blue]new Vue({
el: '#app',
data: {
settings: {
runs: [1, 2, 3]
}
},
methods: {
removeRun: function(i) {
console.log("Remove", i);
this.settings.runs.splice(i,1);
}
}
});


<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue.js"></script>
<table id="app">
<tr v-for="(run, index) in settings.runs">
[/color]
[color=red]
<td>
<input type="text" :name="'run'+index" v-model="settings.runs[index]" />
</td>
[/color]
[color=blue]
<td>
<button @click.prevent="removeRun(index)">X</button>
</td>

<td>
{{run}}
</td>

</tr>
</table>[/color][/size][/b]
Logo

前往低代码交流专区

更多推荐