-
节能设备网站pbootcms模板...
-
水务供水类网站pbootcms模...
-
供水环保设备类网站pb...
-
网页设计类网站pbootcms模...
-
金属热切割设备类网站...
-
企业管理咨询类网站pb...
-
建材装饰公司类网站pb...
-
电脑手机维修类网站pb...
-
家政公司类网站pbootcms模...
-
家政服务保姆月嫂类网站...
-
食品加工企业类网站pb...
-
电动闸门伸缩门类网站...
-
货架货柜类网站pbootcms模...
-
纺织品加工生产类网站...
-
环保新能源企业集团类网...
-
智能机器人类网站pboot...
-
石材石业类网站pbootcms模...
-
建筑装饰设计类网站pb...
-
期刊杂志类网站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>


