themes.js 905 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { theme } from "tailwindcss/stubs/defaultConfig.stub";
  2. /*
  3. * @Author: your name
  4. * @Date: 2024-05-27 15:09:27
  5. * @LastEditTime: 2025-07-17 16:23:06
  6. * @LastEditors: bogon
  7. * @Description: In User Settings Edit
  8. * @FilePath: /performance-test/src/store/themes.js
  9. */
  10. import { colorSchemes } from "@/views/overview/js/colors";
  11. export default {
  12. namespaced: true,
  13. state: {
  14. theme: localStorage.getItem("theme") || process.env.VUE_APP_THEM, //华电默认主题色
  15. themeColor: [...colorSchemes[0].colors],
  16. },
  17. mutations: {
  18. setTheme(state, theme) {
  19. state.theme = theme;
  20. localStorage.setItem("theme", theme);
  21. },
  22. setThemeColor(state, theme) {
  23. state.themeColor = theme;
  24. },
  25. },
  26. actions: {
  27. switchTheme({ commit }, theme) {
  28. commit("setTheme", theme);
  29. },
  30. themeChange({ commit }, theme) {
  31. commit("setThemeColor", theme);
  32. },
  33. },
  34. };