app.js 882 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const state = () => ({
  2. isPc: true,
  3. screen: 'pc',
  4. static: `${process.env.STATIC_URL}/pc`,
  5. loginVisiable: false,
  6. routePrefix: '', // 路由前缀
  7. themeName: 'normal',
  8. screenWidth: 0,
  9. })
  10. const mutations = {
  11. SET_SCREEN(state, width) {
  12. if (width > 768) {
  13. state.isPc = true
  14. state.screen = 'pc'
  15. } else {
  16. state.isPc = false
  17. state.screen = 'h5'
  18. }
  19. state.screenWidth = width
  20. state.static = `${process.env.STATIC_URL}/${state.screen}`
  21. },
  22. SHOW_LOGIN(state) {
  23. state.loginVisiable = true
  24. },
  25. HIDE_LOGIN(state) {
  26. state.loginVisiable = false
  27. },
  28. // 供应商模板类型
  29. SET_ROUTE_PREFIX(state, prefix) {
  30. state.routePrefix = prefix
  31. },
  32. // 设置主题
  33. SET_PAGE_THEME(state, name) {
  34. state.themeName = name
  35. },
  36. }
  37. const actions = {}
  38. export default {
  39. namespaced: true,
  40. state,
  41. mutations,
  42. actions,
  43. }