标签:return [] export ima img tor val ext alt
store.js
import Vue from ‘vue‘
import Vuex from ‘vuex‘
Vue.use(Vuex)
/* 创建初始的状态 */
let state = {
person:[]
};
//状态变化之后修改状态
const actions = {
increase (context, price) {
context.commit(‘addVuex‘, person)
}
};
// 返回改变后的数值
const getters = {
getPerson:state => state.person
// getPerson(state){
// return state.person;
// }
};
//状态变化
const mutations = {
addVuex(state,value){
state.person = value;
}
};
///commonjs的规范,,输出下面四个
export default new Vuex.Store({
state,
mutations,
actions,
getters
})
login.vue
//调用此方法传入需要改变的值
标签:return [] export ima img tor val ext alt
原文地址:http://www.cnblogs.com/hkyyqqq/p/7665665.html