diff --git a/src/store/index.js b/src/store/index.js index 4f8f73b..1b46523 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -12,5 +12,11 @@ export default createStore({ moreCount: (state) => (n) => { return state.count * n } + }, + mutations: { + // payload用于携带参数 + increment(state, payload) { + state.count += payload.num + } } }) diff --git a/src/views/CompositionAPIView.vue b/src/views/CompositionAPIView.vue index 81eca08..2993e76 100644 --- a/src/views/CompositionAPIView.vue +++ b/src/views/CompositionAPIView.vue @@ -1,17 +1,36 @@ diff --git a/src/views/OptionsAPIView.vue b/src/views/OptionsAPIView.vue index 9dcdb48..9773e44 100644 --- a/src/views/OptionsAPIView.vue +++ b/src/views/OptionsAPIView.vue @@ -1,17 +1,40 @@