function createStore({state,mutations}){ return new vue={ data:{ state }, methods:{ commint(mutationType){ return mutations[mutationType](this.state) } } } } const store = createStore({ state:{count:0}, mutations:{ inc(state){ state.count++ }} }) const Counter={ render (h){ return h('div',store.state.count) } } new Vue({ el:'#app', components:{Conter}, methods:{ inc(){ store.commit('inc') } } })