-
廚房廚具類網站pbootcms模...
-
裝修裝飾設計公司類網站...
-
機械加工制造類網站pb...
-
創業資訊文章博客類網站...
-
物業管理類網站pbootcms模...
-
食品加工企業類網站pb...
-
博客類網站pbootcms模板...
-
中英雙語電動葫蘆類網站...
-
水泵設備類網站pbootcms模...
-
證書查詢系統類網站pb...
-
電腦快修維修類網站pb...
-
戶外露營設備類網站pb...
-
新聞博客教程資訊類網站...
-
文藝演出策劃類網站pb...
-
挖土機工程機械設備網站...
-
機械容器類網站pbootcms模...
-
貓糧狗糧類網站pbootcms模...
-
聲學建材類網站pbootcms模...
-
凈水設備類網站pbootcms模...
-
財經新聞資訊類網站pb...
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>




