storage.js 593 B

12345678910111213141516171819202122232425
  1. import { defineStore } from 'pinia';
  2. import { getStoreList } from '@/api/common';
  3. import * as storeUtil from '@/utils/storeUtil';
  4. export const useStorageStore = defineStore('storage', {
  5. state: () => ({
  6. list: [],
  7. activedId: storeUtil.getId() || ''
  8. }),
  9. actions: {
  10. async fetchListData() {
  11. const res = await getStoreList({
  12. // lat: '23.13',
  13. // lng: '113.26'
  14. lat: '0',
  15. lng: '0'
  16. })
  17. this.list = res.data || [];
  18. },
  19. updateActivedId(storageId) {
  20. storeUtil.setId(storageId);
  21. this.activedId = storageId;
  22. }
  23. }
  24. })