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.
35 lines
635 B
35 lines
635 B
import { |
|
defineStore |
|
} from 'pinia'; |
|
import { |
|
ref |
|
} from 'vue'; |
|
|
|
const useSearchInfoStore = defineStore('useSearchInfoStore', () => { |
|
/** 搜索的值 */ |
|
const searchInfo = ref({}) |
|
|
|
/** 新增需要缓存的搜索值 */ |
|
const HANDLE_EDIT_INFO = (pageName, info) => { |
|
searchInfo.value[pageName] = info |
|
} |
|
|
|
/** 删除需要缓存的搜索值 */ |
|
const HANDLE_DELETE = (pageName) => { |
|
delete searchInfo.value[pageName] |
|
} |
|
|
|
/** 清空搜索框的值 */ |
|
const HANDLE_CLEAR = () => { |
|
searchInfo.value = {} |
|
} |
|
|
|
return { |
|
searchInfo, |
|
HANDLE_EDIT_INFO, |
|
HANDLE_DELETE, |
|
HANDLE_CLEAR |
|
} |
|
}) |
|
|
|
export default useSearchInfoStore |