js_reverse/学习VUE/hello_vue3/笔记/编程式路由导航.vue
2024-11-01 17:19:24 +08:00

28 lines
482 B
Vue

<template>
<div class="home">
<img src="http://www.atguigu.com/images/index_new/logo.png" alt="">
</div>
</template>
<script setup lang="ts">
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
onMounted(() =>{
setTimeout(()=>{
//编程式路由导航
router.push('/about')
}, 3000)
})
</script>
<style scoped>
.home {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
</style>