-
企业通用型类网站pboot...
-
环保设备网站pbootcms模板...
-
电气设备类网站pbootcms模...
-
牙科诊所类网站pbootcms模...
-
文艺演出策划类网站pb...
-
新闻博客自媒体类网站...
-
火锅底料餐饮调料食材类...
-
不锈钢金属门类网站pb...
-
空气净化器智能环保设备...
-
心理咨询类网站pbootcms模...
-
装修设计类网站pbootcms模...
-
时尚服装类网站pbootcms模...
-
装饰建材公司类网站pb...
-
建筑装饰工程类网站pb...
-
生活百科资讯类网站pb...
-
电缆材料厂类网站pboot...
-
建筑节能装饰类网站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>