12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { defineStore } from "pinia";
-
- export const commonStore = defineStore("commonStore", {
- state: () => ({
- selectProvince: {
- province: {}, // 省份选择
- bank: {} // 银行选择
- },
- isRefreshListKey: [] // 列表是否需要刷新
- }),
-
- getters: {},
-
- actions: {
- setSelectIndex (key, data) {
- this.selectProvince[key] = data
- },
-
- getSelectIndex (key) {
- let obj = JSON.parse(JSON.stringify(this.selectProvince[key]))
- this.selectProvince[key] = {}
- return obj
- },
-
- setIsRefresh (refreshKey) {
- if (refreshKey) {
- this.isRefreshListKey.push(refreshKey)
- }
- },
-
- getIsRefresh (refreshKey) {
- let index = this.isRefreshListKey.findIndex((item) => item === refreshKey)
- if (index >= 0) {
- this.isRefreshListKey.splice(index, 1)
- return true
- }
- return false
- }
- }
- })
|