global.ts 406 B

12345678910111213141516
  1. import { ref } from "vue"
  2. import { defineStore } from "pinia"
  3. export const useGlobalStore = defineStore('global', () => {
  4. let token = ref('');
  5. const change = function <T>(types: string, value: T): T | string {
  6. if (types == 'token') {
  7. token.value = value as string;
  8. return token.value;
  9. }
  10. return value
  11. }
  12. return {
  13. token, change
  14. }
  15. })