質問編集履歴

1

指摘事項修正

2020/08/06 07:45

投稿

Kimsehwa
Kimsehwa

スコア312

test CHANGED
File without changes
test CHANGED
@@ -156,4 +156,62 @@
156
156
 
157
157
 
158
158
 
159
+ ----
160
+
161
+ mutations(item module)
162
+
163
+
164
+
165
+ ```js
166
+
167
+ addQuestion: (state, question: QuestionState) => {
168
+
169
+ state.questions.push(question);
170
+
171
+ console.log("addQuestion state.questions", state.questions);
172
+
173
+ },
174
+
175
+ ```
176
+
177
+
178
+
179
+ state(item module)
180
+
181
+
182
+
183
+ ```js
184
+
185
+ const state: ItemState = {
186
+
187
+ video_id: "",
188
+
189
+ where: "",
190
+
191
+ questions: []
192
+
193
+ };
194
+
195
+ ```
196
+
197
+
198
+
199
+
200
+
201
+ question追加時のロジック
202
+
203
+
204
+
205
+ ```js
206
+
207
+ const question = this.$store.getters["question/getQuestion"];
208
+
209
+ this.$store.commit("item/addQuestion", question);
210
+
211
+ // this.$store.commit("item/addQuestion", { type: 1 }); <<だとうまく動きました。
212
+
213
+ ```
214
+
215
+
216
+
159
217
  よろしくおねがいします。