teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

指摘事項修正

2020/08/06 07:45

投稿

Kimsehwa
Kimsehwa

スコア312

title CHANGED
File without changes
body CHANGED
@@ -77,4 +77,33 @@
77
77
  },
78
78
  ```
79
79
 
80
+ ----
81
+ mutations(item module)
82
+
83
+ ```js
84
+ addQuestion: (state, question: QuestionState) => {
85
+ state.questions.push(question);
86
+ console.log("addQuestion state.questions", state.questions);
87
+ },
88
+ ```
89
+
90
+ state(item module)
91
+
92
+ ```js
93
+ const state: ItemState = {
94
+ video_id: "",
95
+ where: "",
96
+ questions: []
97
+ };
98
+ ```
99
+
100
+
101
+ question追加時のロジック
102
+
103
+ ```js
104
+ const question = this.$store.getters["question/getQuestion"];
105
+ this.$store.commit("item/addQuestion", question);
106
+ // this.$store.commit("item/addQuestion", { type: 1 }); <<だとうまく動きました。
107
+ ```
108
+
80
109
  よろしくおねがいします。