You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
674 B

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. //引用Vuex
  2. import Vue from 'vue'
  3. import Vuex from 'vuex'
  4. import i18n from '@/locale/index.js'
  5. Vue.use(Vuex)
  6. import request from '@/utils/request.js'
  7. //实例store对象
  8. const store = new Vuex.Store({
  9. state: {
  10. unit : '$',
  11. key : {
  12. 'ar' : 'keyA', //阿拉伯
  13. 'en' : 'keyEnglish', //英语
  14. 'es' : 'keySpanish', //西班牙
  15. 'fr' : 'keyF', //法语
  16. 'ru' : 'keyE' //俄语
  17. },
  18. },
  19. mutations: {
  20. getUnit(state){
  21. request('getUnit').then(res => {
  22. if(res.code == 200){
  23. state.unit = res.result[state.key[i18n.locale]]
  24. }
  25. })
  26. },
  27. }
  28. })
  29. //导出store对象
  30. export default store
  31. //export default const store或者export const store会报错