回答編集履歴
1
typo
answer
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
buttonTextがひとつしかないから。itemsの数だけbuttonTextが必要なのではないでしょうか。手っ取り早いのは、こうすることかと。
|
2
2
|
```vue
|
3
|
+
|
3
|
-
|
4
|
+
<tr v-for="(item,index) in items" @click="onClick(index,$event)">
|
5
|
+
<td>{{item.name}}</td>
|
6
|
+
<td><button>{{item.buttonText ? '追加する': '追加済み'}}</button></td>
|
7
|
+
</tr>
|
8
|
+
...
|
9
|
+
// buttonText: true
|
4
10
|
items: [
|
5
11
|
{ name: "リンゴ", buttonText: true},
|
6
12
|
{ name: "ミカン", buttonText: true},
|