theme.ts 879 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {defineStore} from "pinia";
  2. import titleLogo from '@/assets/images/web/web-home_title.png'
  3. import webBgImg from '@/assets/images/web/web-home_bg.png'
  4. import loginImg from '@/assets/images/global/login-img.png'
  5. export const useThemeStore = defineStore('theme', {
  6. state: () => ({
  7. init: false,
  8. title: '智慧搜索平台',
  9. subTitle: '',
  10. logo: '',
  11. titleLogo: '',
  12. webBgImg: webBgImg,
  13. loginImg: loginImg,
  14. }),
  15. getters: {
  16. },
  17. actions: {
  18. setTheme(config) {
  19. this.init = true
  20. const setValue = (key1, key2) => {
  21. if (config[key2]) {
  22. this[key1] = config[key2]
  23. }
  24. }
  25. setValue('title', 'title')
  26. setValue('subTitle', 'subTitle')
  27. setValue('logo', 'logo')
  28. setValue('titleLogo', 'titleLogo')
  29. setValue('webBgImg', 'webBgImg')
  30. setValue('loginImg', 'loginImg')
  31. }
  32. },
  33. })