common.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** @format */
  2. import { defineStore } from 'pinia'
  3. import { useUserStore } from './user'
  4. export const useCommonStore = defineStore(
  5. 'commonStore',
  6. () => {
  7. const navigateTextColor = ref('#ffffff')
  8. const navigateBgColor = ref('#0F0820')
  9. // const userStore = useUserStore()
  10. const setNavigateBgColor = (color: string) => {
  11. if (!color)
  12. return
  13. color = color.toUpperCase()
  14. console.log('newColor-----color', color)
  15. if (color === '#0F0820') {
  16. navigateTextColor.value = '#ffffff'
  17. navigateBgColor.value = `${color}`
  18. }
  19. else if (color === '#F3F4FB') {
  20. navigateTextColor.value = '#0F0820'
  21. navigateBgColor.value = `${color}`
  22. }
  23. else if (color === '#FFFFFF') {
  24. console.log('newColor-----color---2', color)
  25. navigateTextColor.value = '#0F0820'
  26. navigateBgColor.value = `${color}`
  27. }
  28. }
  29. return {
  30. navigateTextColor,
  31. navigateBgColor,
  32. setNavigateBgColor,
  33. }
  34. },
  35. {
  36. persist: true,
  37. },
  38. )