質問編集履歴

5

解決コードの記述位置を間違えたので修正します。

2020/12/08 20:17

投稿

ariunko
ariunko

スコア4

test CHANGED
File without changes
test CHANGED
@@ -157,23 +157,3 @@
157
157
  }
158
158
 
159
159
  ```
160
-
161
-
162
-
163
- ### 自己解決しました
164
-
165
-
166
-
167
- `nuxt.config.js`に@nuxtjs/composition-apiを追加しました。
168
-
169
-
170
-
171
- ```json
172
-
173
- modules: [
174
-
175
- '@nuxtjs/composition-api',
176
-
177
- ],
178
-
179
- ```

4

解決しました。

2020/12/08 20:17

投稿

ariunko
ariunko

スコア4

test CHANGED
File without changes
test CHANGED
@@ -157,3 +157,23 @@
157
157
  }
158
158
 
159
159
  ```
160
+
161
+
162
+
163
+ ### 自己解決しました
164
+
165
+
166
+
167
+ `nuxt.config.js`に@nuxtjs/composition-apiを追加しました。
168
+
169
+
170
+
171
+ ```json
172
+
173
+ modules: [
174
+
175
+ '@nuxtjs/composition-api',
176
+
177
+ ],
178
+
179
+ ```

3

試したことのリストを追加しました。

2020/12/08 20:16

投稿

ariunko
ariunko

スコア4

test CHANGED
File without changes
test CHANGED
@@ -100,7 +100,11 @@
100
100
 
101
101
  ・reactiveにcomputedを使用したが反応しないので戻した。
102
102
 
103
- ・mapStateやmpaMutationsも試したが反応しないというか正しい記述かわからないので戻した。
103
+ ・mapStateやmapMutationsも試したが反応しないというか正しい記述かわからないので戻した。
104
+
105
+ ・commitにtype型としてmutationsのメソッドを指定しても反応しなかった。
106
+
107
+ ・button要素をa要素に変更しても反応しなかった。
104
108
 
105
109
 
106
110
 

2

commitの引数をタイプ型を使ってincrementメソッドを指定しても機能しなかった

2020/12/02 01:27

投稿

ariunko
ariunko

スコア4

test CHANGED
File without changes
test CHANGED
@@ -55,6 +55,8 @@
55
55
  <p>{{ $store.commit('increment', {num: 1}) }}</p> // 意味ないが最初に1加算される
56
56
 
57
57
  <button @click="$store.commit('increment', {num: 1})"> // 押しても加算されない
58
+
59
+ <!-- <button @click="$store.commit({type: 'increment', num: 1})"> -->// type型に置き換えても加算されない
58
60
 
59
61
  カウント:{{ $store.state.count }} // 2が表示される
60
62
 

1

ソースコードのファイル名が間違ってたので修正しました。

2020/12/02 01:21

投稿

ariunko
ariunko

スコア4

test CHANGED
File without changes
test CHANGED
@@ -13,6 +13,8 @@
13
13
 
14
14
 
15
15
  ```javascript
16
+
17
+ // store/index.js
16
18
 
17
19
  import Vuex from 'vuex'
18
20
 
@@ -40,7 +42,7 @@
40
42
 
41
43
  ```htmlmixed
42
44
 
43
- // store/index.js
45
+ // pages/index.vue
44
46
 
45
47
  <template>
46
48