useLogin.ts 627 B

123456789101112131415161718192021222324252627282930
  1. import type { LocationQueryRaw } from 'vue-router'
  2. import { useRouter } from 'vue-router'
  3. import storage from '@/utils/storage'
  4. export function useLogin() {
  5. /**
  6. * 设置登录返回页
  7. */
  8. const setLoginBack = (route: LocationQueryRaw) => {
  9. storage.set({
  10. key: 'loginBack',
  11. data: {
  12. path: route.path,
  13. query: route.query
  14. }
  15. })
  16. }
  17. /**
  18. * 执行登录后跳转
  19. */
  20. const handleLoginBack = (callbak:any) => {
  21. if(callbak) callbak()
  22. }
  23. return {
  24. setLoginBack,
  25. handleLoginBack
  26. }
  27. }