-
APP应用程序官网类网站...
-
运动健身类网站pbootcms模...
-
活动隔断装修装饰类网站...
-
国际教育出国留学类网站...
-
大理石瓷砖生产类网站...
-
企业产品展示类网站pb...
-
蔬菜水果配送类网站pb...
-
新闻资讯网站教程类网站...
-
注塑加工类网站pbootcms模...
-
厨房厨具类网站pbootcms模...
-
车牌识别系统类网站pb...
-
广告策划类网站pbootcms模...
-
沙盘模型制作类网站pb...
-
装修地暖管材类网站pb...
-
不锈钢金属门类网站pb...
-
粮食米业类网站pbootcms模...
-
矿山矿石设备类网站pb...
-
建筑资质办理类网站pb...
-
电子产品类网站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>