common.ts 978 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. if (color === '#0F0820') {
  15. navigateTextColor.value = '#ffffff'
  16. navigateBgColor.value = 'rgba(15,8,32, 0.7)'
  17. }
  18. else if (color === '#F3F4FB') {
  19. navigateTextColor.value = '#0F0820'
  20. navigateBgColor.value = 'rgba(243,244,251, 0.7)'
  21. }
  22. else if (color === '#FFFFFF') {
  23. navigateTextColor.value = '#0F0820'
  24. navigateBgColor.value = 'rgba(255, 255, 255, 0.7)'
  25. }
  26. }
  27. return {
  28. navigateTextColor,
  29. navigateBgColor,
  30. setNavigateBgColor,
  31. }
  32. },
  33. {
  34. persist: true,
  35. },
  36. )