vuex
具体的东西需要找官方文档查一下了,这里贴一段代码,哈哈哈
#store
const state={ homeData:{} }; const getters={ }; const mutations={ }; const actions={ getDate(context){ Vue.http.get("/fuli/getData").then(function(response){ response.data.money=response.data.result_info.aiWRbRtrt.pool.split(""); context.state.homeData=response.data; },function(response){ }) } }; export default new Vuex.Store({ state, getters, mutations, actions })
#vue
new Vue({ el: '#app', store, created:function(){ store.dispatch("getDate") }, render: h => h(App) });
#.vue文件获取值
this.$store.state