theme.js 518 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // 公共模块
  2. // // #ifdef H5
  3. // const prefix = '/api'
  4. // // #endif
  5. // // #ifndef H5
  6. // const prefix = ''
  7. // // #endif
  8. const state = {
  9. pattern: uni.getStorageSync('pattern') || 'light',
  10. }
  11. const getters = {
  12. pattern: state => state.pattern
  13. }
  14. const actions = {
  15. changePattern(context, data) {
  16. context.commit("setPattern", data);
  17. }
  18. }
  19. const mutations = {
  20. setPattern(state, data) {
  21. state.pattern = data;
  22. uni.setStorageSync('pattern', data)
  23. },
  24. }
  25. export default {
  26. state,
  27. mutations,
  28. actions,
  29. getters
  30. }