index.js 591 B

12345678910111213141516171819202122232425
  1. import {defineStore} from 'pinia'
  2. import pinia from "../store/init"
  3. import config from '../config/index';
  4. import {clearStorage} from "@/utils/storage";
  5. export const useAppStore = defineStore('main', {
  6. //getStorage, setStorage,
  7. state: () => ({
  8. onUpdate: null,
  9. }),
  10. actions: {
  11. setOnUpdate(value) {
  12. this.onUpdate = value
  13. },
  14. //清除缓存和token
  15. clearStoreData() {
  16. this.onUpdate = null
  17. clearStorage()
  18. },
  19. }
  20. })
  21. export default function useUserStoreWidthOut() {
  22. return useAppStore(pinia);
  23. }