App.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <router-view />
  3. </template>
  4. <script lang="ts" setup>
  5. import { useRouter } from 'vue-router'
  6. import { closeToast, showLoadingToast } from 'vant'
  7. const router = useRouter()
  8. // 在路由跳转前启动加载动画
  9. router.beforeEach((to, from, next) => {
  10. showLoadingToast({
  11. duration: 0,
  12. forbidClick: true,
  13. message: '加载中...',
  14. });
  15. next()
  16. })
  17. // 在路由跳转后隐藏加载动画
  18. router.afterEach(() => {
  19. closeToast();
  20. })
  21. </script>
  22. <style >
  23. .flex {
  24. display: flex;
  25. }
  26. .flexColumn {
  27. flex-direction: column;
  28. }
  29. .center {
  30. align-items: center;
  31. justify-content: center;
  32. }
  33. .alignCenter {
  34. align-items: center;
  35. }
  36. .alignStart {
  37. align-items: flex-start;
  38. }
  39. .alignEnd {
  40. align-items: flex-end;
  41. }
  42. .spaceBetween {
  43. justify-content: space-between;
  44. }
  45. .spaceEvenly {
  46. justify-content: space-evenly;
  47. }
  48. .spaceAround {
  49. justify-content: space-around;
  50. }
  51. .spaceCenter {
  52. justify-content: center;
  53. }
  54. .justifyEnd {
  55. justify-content: flex-end;
  56. }
  57. .allFlex {
  58. flex: 1;
  59. }
  60. .flexWrap {
  61. flex-wrap: wrap;
  62. }
  63. .flexNoWrap {
  64. flex-wrap: nowrap;
  65. }
  66. .width1 {
  67. width: 10%;
  68. }
  69. .width2 {
  70. width: 20%;
  71. }
  72. .width3 {
  73. width: 30%;
  74. }
  75. .width4 {
  76. width: 40%;
  77. }
  78. .width5 {
  79. width: 50%;
  80. }
  81. .width6 {
  82. width: 60%;
  83. }
  84. .width7 {
  85. width: 70%;
  86. }
  87. .width8 {
  88. width: 80%;
  89. }
  90. .width9 {
  91. width: 90%;
  92. }
  93. .width10 {
  94. width: 100%;
  95. }
  96. </style>