私はリストをレンダリングするために次のコードを使用しています:Vuejs - イベントの代表団とvのコンテキスト参照
<div @click.prevent="myhandler($event)"><!-- Delegated event handler-->
<div class="tasks" v-for="(task, subName) in step.tasks">
<button type="button">
{{ task.caption }}
</button>
<span> {{ task.callableName }} </span>
</div>
</div>
methods: {
myhandler(e){
// Event target may be a button element.
let target = e.target;
// …
// Let's assume we know 'target' is a button element instance.
// I wish I could have access to the v-for item ("task") which is associated in some ways to the button that was clicked.
// let the_task_reference = ?;
}…
私はそこにきれいな方法を私はv-for
スコープ特定のタスクを達することができるようにそのボタンに関連していますか?
ありがとうございます。
それは私が考えたことです。私はおそらく他のきちんとした選択肢がないように思われるので、おそらくそれに行くでしょう。多分もう一日質問を生き返らせ、あなたの答えを解決策として考えてみましょう。ありがとうございました。 – Stphane