• VUE框架的路由


    <template>
    <nav>
    <router-link to="/">Home</router-link> | //路由导航栏
    <router-link to="/about">About</router-link> |
    <a href="http://www.baidu.com">百度</a> //http a标签的跳转功能
    </nav>
    <router-view/> //路由功能
    </template>

    <style>
    #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    }

    nav {
    padding: 30px;
    }

    nav a {
    font-weight: bold;
    color: #2c3e50;
    }

    nav a.router-link-exact-active {
    color: #42b983;
    }
    </style>
    import { createRouter, createWebHistory } from 'vue-router'
    import HomeView from '../views/HomeView.vue'

    const routes = [
    {
    path: '/',
    name: 'home',
    component: HomeView
    },
    {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    }
    ]

    const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
    })

    export default router
  • 相关阅读:
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    C++11六大函数(构造函数,移动构造函数,移动赋值操作符,复制构造函数,赋值操作符,析构函数)
    C++中virtual继承的深入理解
  • 原文地址:https://www.cnblogs.com/A121/p/16389205.html
Copyright © 2020-2023  润新知