38 lines
		
	
	
		
			726 B
		
	
	
	
		
			JavaScript
		
	
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			726 B
		
	
	
	
		
			JavaScript
		
	
	
	
|  | import Vue from 'vue' | |||
|  | import Vuex from "vuex" | |||
|  | Vue.use(Vuex) | |||
|  | 
 | |||
|  | export default new Vuex.Store({ | |||
|  | 	// 全局属性变量
 | |||
|  | 	state: { // state的作用是定义属性变量。定义一个参数
 | |||
|  | 		orderDetail: null, | |||
|  | 		host: '', | |||
|  | 		currencyIcon: '', | |||
|  | 		languages:[], | |||
|  | 		localLang:'' | |||
|  | 	}, | |||
|  | 	// 全局同步方法,在methods{this.$store.commit("changeTheme")}
 | |||
|  | 	mutations: { | |||
|  | 		changeOrderDetail(state, value) { | |||
|  | 			state.orderDetail = value; | |||
|  | 		}, | |||
|  | 		changeHost(state, value) { | |||
|  | 			state.host = value; | |||
|  | 		}, | |||
|  | 		changeCurrency(state, value) { | |||
|  | 			state.currencyIcon = value; | |||
|  | 		}, | |||
|  | 		changeLanguages(state, value) { | |||
|  | 			state.languages = value; | |||
|  | 		}, | |||
|  | 		changeLocal(state, value) { | |||
|  | 			state.localLang = value; | |||
|  | 		} | |||
|  | 	}, | |||
|  | 	getters: { | |||
|  | 		 | |||
|  | 	}, | |||
|  | 	actions: { | |||
|  | 	} | |||
|  | 
 | |||
|  | }) |