app.js 834 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. })
  9. const mutations = {
  10. SET_SCREEN(state, width) {
  11. if (width > 768) {
  12. state.isPc = true
  13. state.screen = 'pc'
  14. } else {
  15. state.isPc = false
  16. state.screen = 'h5'
  17. }
  18. state.static = `${process.env.STATIC_URL}/${state.screen}`
  19. },
  20. SHOW_LOGIN(state) {
  21. state.loginVisiable = true
  22. },
  23. HIDE_LOGIN(state) {
  24. state.loginVisiable = false
  25. },
  26. // 供应商模板类型
  27. SET_ROUTE_PREFIX(state, prefix) {
  28. state.routePrefix = prefix
  29. },
  30. // 设置主题
  31. SET_PAGE_THEME(state, name) {
  32. state.themeName = name
  33. },
  34. }
  35. const actions = {}
  36. export default {
  37. namespaced: true,
  38. state,
  39. mutations,
  40. actions,
  41. }