app.config.js 757 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {
  2. getToken,
  3. setToken
  4. } from "@/utils/common.js"
  5. const state = {
  6. token: getToken(),
  7. headHeight: '100rpx',
  8. statusBarHeight: 0,
  9. // 涨跌颜色
  10. stocksColor: 'green_rise', // green_rise:绿涨红跌 , red_rise:绿跌红涨
  11. }
  12. const mutations = {
  13. SET_statusBarHeight: (state, Height) => {
  14. state.statusBarHeight = Height
  15. },
  16. SET_STOCKS_COLOR: (state, code) => {
  17. state.stocksColor = code
  18. },
  19. SET_TOKEN: (state, token) => {
  20. setToken(token)
  21. state.token = token
  22. }
  23. }
  24. const actions = {
  25. // setToken = (token) => {
  26. // console.log('token = ' , token)
  27. // }
  28. setToken({
  29. commit
  30. }, token) {
  31. commit('SET_TOKEN', token)
  32. },
  33. }
  34. export default {
  35. namespaced: true,
  36. state,
  37. mutations,
  38. actions
  39. }