app.js 729 B

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