index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div></div>
  3. </template>
  4. <script lang="ts" setup>
  5. import { unref, onMounted } from 'vue';
  6. import { useRouter } from 'vue-router';
  7. import { router } from '/@/router';
  8. const { currentRoute, replace, } = useRouter();
  9. const { params, query } = unref(currentRoute);
  10. const { path, _redirect_type = 'path' } = params;
  11. Reflect.deleteProperty(params, '_redirect_type');
  12. Reflect.deleteProperty(params, 'path');
  13. const _path = Array.isArray(path) ? path.join('/') : path;
  14. onMounted(() => {
  15. if(query && query['redirect']) router.push({path: query['redirect']})
  16. // if (_redirect_type === 'name') {
  17. // // replace({
  18. // // name: _path,
  19. // // query,
  20. // // params,
  21. // // });
  22. // router.push({
  23. // name: _path,
  24. // query,
  25. // params
  26. // })
  27. // } else {
  28. // // replace({
  29. // // path: _path.startsWith('/') ? _path : '/' + _path,
  30. // // query,
  31. // // });
  32. // router.push({
  33. // path: _path.startsWith('/') ? _path : '/' + _path,
  34. // query,
  35. // })
  36. // }
  37. })
  38. </script>