-
厨房厨具类网站pbootcms模...
-
装修装饰设计公司类网站...
-
机械加工制造类网站pb...
-
创业资讯文章博客类网站...
-
物业管理类网站pbootcms模...
-
食品加工企业类网站pb...
-
博客类网站pbootcms模板...
-
中英双语电动葫芦类网站...
-
水泵设备类网站pbootcms模...
-
证书查询系统类网站pb...
-
电脑快修维修类网站pb...
-
户外露营设备类网站pb...
-
新闻博客教程资讯类网站...
-
文艺演出策划类网站pb...
-
挖土机工程机械设备网站...
-
机械容器类网站pbootcms模...
-
猫粮狗粮类网站pbootcms模...
-
声学建材类网站pbootcms模...
-
净水设备类网站pbootcms模...
-
财经新闻资讯类网站pb...
1. 使用路由导航(Vue Router)进行页面跳转:
// 在路由配置文件中定义路由
import { createRouter, createWebHistory } from 'vue-router';
const routes = [
{ path: '/', component: Home },
{ path: '/about', component: About },
// ...
];
const router = createRouter({
history: createWebHistory(),
routes,
});
// 在组件中使用路由导航
<template>
<button @click="goToAbout">Go to About</button>
</template>
2. 使用`<router-link>`组件进行页面跳转:<script>
import { useRouter } from 'vue-router';
export default {
methods: {
goToAbout() {
const router = useRouter();
router.push('/about');
},
},
};
</script>
3. 使用`window.location`进行页面跳转:<template>
<router-link to="/about">Go to About</router-link>
</template>
4. 使用`<a>`标签进行页面跳转:<template>
<button @click="goToAbout">Go to About</button>
</template>
<script>
export default {
methods: {
goToAbout() {
window.location.href = '/about';
},
},
};
</script>
这些是一些常见的页面跳转方式,你可以根据具体的需求选择适合的方式来实现页面跳转。<template>
<a href="/about">Go to About</a>
</template>




