| 123456789101112131415161718192021222324252627282930 |
- <template>
- <router-view />
- </template>
- <script lang="ts" setup>
- import { useRouter } from 'vue-router'
- import { closeToast, showLoadingToast } from 'vant'
- const router = useRouter()
- // 在路由跳转前启动加载动画
- router.beforeEach((to, from, next) => {
- showLoadingToast({
- duration: 0,
- forbidClick: true,
- message: '加载中...',
- });
- next()
- })
- // 在路由跳转后隐藏加载动画
- router.afterEach(() => {
- closeToast();
- })
- </script>
- <style >
- </style>
|