公司官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
592 B

  1. import { defineStore } from 'pinia'
  2. import { ref, computed, reactive } from 'vue'
  3. import api from '@/api'
  4. // 定义案例数据存储
  5. export const useConfigStore = defineStore('config', () => {
  6. const configParams = reactive({})
  7. const map = {
  8. 0 : 'text',
  9. 1 : 'content',
  10. 2 : 'imageUrl',
  11. }
  12. const getConfigParams = async () => {
  13. const res = await api.fetchConfigParams()
  14. res.forEach(item => {
  15. configParams[item.code] = item[map[item.type]]
  16. })
  17. }
  18. return {
  19. configParams,
  20. getConfigParams
  21. }
  22. })