0
私はVue.jsでかなり新しく、私が打ち明けている問題の大部分を理解している間に、私はこの問題の周りに頭を浮かべることができません。v-modelで複数フィールドの入力を停止しますか?
私はAPIの出力に基づいて投稿のリストを表示しており、投稿ごとにコメントボックスが必要です。 APIへのポスティングは正常に機能していますが問題なく追加しますが、ループの各入力に同じvモデルを使用しているため、入力されたテキストはバインディングのために他のすべての入力に複製されます。
<div class="row" v-if="">
<div class="col-md-11">
<input type="text" class="form-control" value="" title=""
placeholder="Add comments here.." v-model="note.note">
</div>
<div class="col-md-1">
<button type="button" class="btn btn-default" style="margin-left: -1.5rem" v-on:click="addNote(task.id)">Add Comment</button>
</div>
</div>
JS:
addNote: function (id) {
if (this.note.note) {
Vue.http.headers.common['X-CSRF-TOKEN'] = document.querySelector('#token').getAttribute('value');
this.$http.post('api/note/create/' + id, this.note).then(function (response) {
this.fetchTaskList();
});
}
}
スクリーンショット:
私が使用する必要があります異なるディレクティブがありますか?それとも別の方法がありますか?