回答編集履歴
2
修正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`toCart`はストアのactionなので、`$store.dispatch`
|
1
|
+
`toCart`はストアのactionなので、`$store.dispatch`で呼び出す必要があります。
|
2
2
|
|
3
3
|
```html
|
4
4
|
<button @click="$store.dispatch('toCart', product)">Add to cart</button>
|
1
修正
answer
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
`toCart`はストアのactionなので、`$store`が必要です。
|
1
|
+
`toCart`はストアのactionなので、`$store.dispatch`が必要です。
|
2
2
|
|
3
3
|
```html
|
4
|
-
<button @click="$store.
|
4
|
+
<button @click="$store.dispatch('toCart', product)">Add to cart</button>
|
5
5
|
```
|