-
摄影机构类网站pbootcms模...
-
弹簧针探针类网站pboot...
-
智能安防监控类网站pb...
-
汽车配件类网站pbootcms模...
-
灯具照明类网站pbootcms模...
-
电线电缆厂家类网站pb...
-
物料自动化机械设备类网...
-
网址发布类网站pbootcms模...
-
五金电器出口英文外贸类...
-
礼品礼盒类pbootcms模板...
-
门窗定制类网站pbootcms模...
-
建筑装饰装修类网站pb...
-
家具生产类网站pbootcms模...
-
道路护栏交通设施类网站...
-
电子数码类网站pbootcms模...
-
轻钢房屋建筑类网站pb...
-
DJ音乐培训机构类网站...
-
数控车床类网站pbootcms模...
-
五金制品类网站pbootcms模...
-
零食食品类网站pbootcms模...
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>


