zoukankan      html  css  js  c++  java
  • router 配置按需加载对应的组件,配置active

     1 const routes = [
     2   {
     3     path: '/',
     4     component: App,
     5     children: [
     6       {path: '/index/:type', name: 'index', component: Index},
     7       {path: '/home', name: 'home', component: Home},
     8       {path: '/HomeUserInfo/:uid', name: 'homeUserInfo', component: HomeUserInfo},
     9       {path: '/article/:id', name: 'article', component: Article},
    10       {path: '/addmsg', name: 'addMsg', component: AddMsg},
    11       {path: '/search/:types', name: 'searchresult', component: SearchResult},
    12       {path: '/login', name: 'login', component: Login},
    13       {path: '/register', name: 'register', component: Register},
    14       {path: '/modif', name: 'Modifi', component: Modifi},
    15       {path: '/admin', name: 'Admin', component: Admin}
    16     ]
    17   }
    18 ]
    19 const router = new VueRouter({
    20   routes: routes, // short for routes: routes
    21   linkActiveClass: 'active',  // router-link的选中状态的class,也有一个默认的值
    22   history: true
    23 })
  • 相关阅读:
    Form表单提交数据的几种方式
    前端基础-HTML
    python入门函数详解
    Python作业编写
    Python入门数据类型详解
    Jquery选择器
    做外链接和有外链接区别
    三层架构
    drop,delete,truncate区别
    run()和star()区别
  • 原文地址:https://www.cnblogs.com/xiaomili/p/6597667.html
Copyright © 2011-2022 走看看