- 服装定制设计类网站织梦...
- 餐饮美食类网站织梦模板...
- 电脑机箱配件类网站织梦...
- 苗木草坪种植绿化类网站...
- 宠物兽医门诊医院类网站...
- 艺考培训类网站织梦模板...
- 阀门制造设备展示类网站...
- 新闻博客资讯类网站织梦...
- PPT素材下载类网站织梦模...
- 五金水槽挂架类网站织梦...
- QQ个性空间日志资讯类网...
- 五金配件加工机械设备类...
- 微商货源网店代理类网站...
- 生态水果蔬菜商城类网站...
- 甲醛检测空气污染治理类...
- 律师事务所网站织梦模板...
- 财经新闻资讯类网站织梦...
- 水性工业漆类企业网站织...
- 中国风古典园林假山工程...
- 金融理财投资类网站织梦...
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>