diff --git a/20_脚手架/vue_code/src/components/Count.vue b/20_脚手架/vue_code/src/components/Count.vue index 4a8b18f..8dd2603 100644 --- a/20_脚手架/vue_code/src/components/Count.vue +++ b/20_脚手架/vue_code/src/components/Count.vue @@ -1,19 +1,23 @@ \ No newline at end of file diff --git a/20_脚手架/vue_code/src/store/index.js b/20_脚手架/vue_code/src/store/index.js index f4061aa..e7a1f9a 100644 --- a/20_脚手架/vue_code/src/store/index.js +++ b/20_脚手架/vue_code/src/store/index.js @@ -32,7 +32,16 @@ const mutations = { } //准备state-用于存储数据 const state = { - sum: 0 + sum: 0, + school: '修仙学院', + subject: '修仙' +} + +// getters 用于对state中的数据进行加工,类似用computed +const getters = { + bigSum(state) { + return state.sum * 10 + } } // 创建并导出store @@ -40,4 +49,5 @@ export default new Vuex.Store({ actions, mutations, state, + getters })