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.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { defineStore } from "pinia";
  2. export const commonStore = defineStore("commonStore", {
  3. state: () => ({
  4. selectProvince: {
  5. province: {}, // 省份选择
  6. bank: {} // 银行选择
  7. },
  8. isRefreshListKey: [] // 列表是否需要刷新
  9. }),
  10. getters: {},
  11. actions: {
  12. setSelectIndex (key, data) {
  13. this.selectProvince[key] = data
  14. },
  15. getSelectIndex (key) {
  16. let obj = JSON.parse(JSON.stringify(this.selectProvince[key]))
  17. this.selectProvince[key] = {}
  18. return obj
  19. },
  20. setIsRefresh (refreshKey) {
  21. if (refreshKey) {
  22. this.isRefreshListKey.push(refreshKey)
  23. }
  24. },
  25. getIsRefresh (refreshKey) {
  26. let index = this.isRefreshListKey.findIndex((item) => item === refreshKey)
  27. if (index >= 0) {
  28. this.isRefreshListKey.splice(index, 1)
  29. return true
  30. }
  31. return false
  32. }
  33. }
  34. })