diff --git a/src/store/modules/ModuleA.js b/src/store/modules/ModuleA.js index 69c9967..00d45c5 100644 --- a/src/store/modules/ModuleA.js +++ b/src/store/modules/ModuleA.js @@ -9,12 +9,14 @@ export const moduleA = { }, mutations: { mutation_a(state, payload) { - state.state_a + payload.num; + state.state_a += payload.num; } }, actions: { - action_a(content, payload){ - content.commit('mutation_a', {num: payload.num}) + action_a(content, payload) { + if (content.state.state_a > 50) { + content.commit('mutation_a', {num: payload.num}) + } } } } diff --git a/src/store/modules/ModuleB.js b/src/store/modules/ModuleB.js index bbd8b38..0f1683a 100644 --- a/src/store/modules/ModuleB.js +++ b/src/store/modules/ModuleB.js @@ -10,12 +10,14 @@ export const moduleB = { }, mutations: { mutation_b: (state, payload) => { - state.state_b + payload.num; + state.state_b += payload.num; } }, actions: { action_b: (content, payload) => { - content.commit('mutation_b', {num: payload.num}) + if (content.state.state_b > 50) { + content.commit('mutation_b', {num: payload.num}) + } } } } diff --git a/src/views/CompositionAPIView.vue b/src/views/CompositionAPIView.vue index 05f9b53..093c864 100644 --- a/src/views/CompositionAPIView.vue +++ b/src/views/CompositionAPIView.vue @@ -1,49 +1,75 @@ diff --git a/src/views/OptionsAPIView.vue b/src/views/OptionsAPIView.vue index e26436a..5e46869 100644 --- a/src/views/OptionsAPIView.vue +++ b/src/views/OptionsAPIView.vue @@ -1,59 +1,73 @@