当前位置:网站首页>路由-Tab切换页面
路由-Tab切换页面
2022-08-02 12:49:00 【给我来个鸡腿】
效果

代码结构

代码
router.js
import { createRouter, createWebHashHistory } from 'vue-router'
import Page1 from '../views/Page1.vue'
import Page2 from '../views/Page2.vue'
import Page3 from '../views/Page3.vue'
const routes = [
{
path: '/page1',
component: Page1
},
{
path: '/page2',
component: Page2
},
{
path: '/page3',
component: Page3
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
export default router
app.vue
<template>
<Tab />
<router-view />
</template>
<script setup>
import Tab from '@/components/tab'
</script>
<style>
</style>tab.vue
<template>
<div class="tab">
<router-link tag="div" to="/page1" class="tab-item">Page1</router-link>
<router-link tag="div" to="/page2" class="tab-item">Page2</router-link>
<router-link tag="div" to="/page3" class="tab-item">Page2</router-link>
</div>
</template>边栏推荐
猜你喜欢

【The 6th Strong Net Cup CTF-Wp】

Js scratchable latex style draw plug-in

自定义mvc框架复习

汉源高科千兆12光12电管理型工业以太网交换机 12千兆光12千兆电口宽温环网交换机

php——三篇夯实根基第一篇

FreeRTOS--栈实验

SQL Server如何建表

SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution

软件成分分析:手握5大能力守护软件供应链安全

FreeRTOS--Priority Experiment
随机推荐
PHP+MYSQL [Student Information Management System] (Minimalist Edition)
unique in numpy & pandas
Data Lake (3): Hudi Concept Terminology
php - the first of three solid foundations
zabbix自动化监控脚本
FreeRTOS--stack experiment
MFC入门教程(深入浅出MFC)
SQL Server修改数据
第11章 文件
simulink PID自动整定
php字符串的截取方式
pytorch model to tensorflow model
SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution
30 lines of code to realize serverless real-time health code recognition -- operation manual
三种实现分布式锁的方式
Chapter 11 Documents
技术分享| 融合调度系统中的电子围栏功能说明
Name conventions in FreeRTOS
瀑布流式布局怎么实现(什么是瀑布流布局)
sql concat()函数