import * as type from '../testMuation_type' const testData={ state:{ pInfo:[{testName:"测试人员",testAge:20}], title:"测试标题", decs:"测试描述" }, mutations:{ [type.GET_TEST]:(state)=>{ //console.log(state.title) //return state.title//返回undefined state.title=state.title+":"+"不能return,使用return返回undefined"; }, [type.Add_TEST]:(state,data)=>{ state.pInfo.push(data); } } } export default testData export const GET_TEST="GET_TEST" export const Add_TEST="ADD_TEST" computed: { ...mapGetters(['asideCollapse','currentApp']), ...mapState({ // 动态主路由 mainMenu: state => state.permission.addRouters, titTest:state=>state.test.title }), }, methods: { ...mapMutations([ 'TOOGLE_ASIDE', 'SET_CURRENTAPP', 'GET_TEST' ]), console.log(this.titTest) this.GET_TEST()//muations里不能return console.log(this.titTest)