zoukankan      html  css  js  c++  java
  • 初试 vue2.0——7.项目开发_路由重定向

    写在前面的话:

      在vue1.0中的方式(貌似使用的是 go),在2.0中不太一样了。

    做法:在index.js中,加入 redirect配置即可。

     1 import Vue from 'vue'
     2 import Router from 'vue-router'
     3 import goods from 'router/goods/goods'
     4 import ratings from 'router/ratings/ratings'
     5 import seller from 'router/seller/seller'
     6 
     7 Vue.use(Router)
     8 
     9 export default new Router({
    10   routes: [
    11     {
    12       path: '/',
    13       redirect: '/goods',
    14       component: goods
    15     },
    16     {
    17       path: '/goods',
    18       name: 'goods',
    19       component: goods
    20     },
    21     {
    22       path: '/ratings',
    23       name: 'ratings',
    24       component: ratings
    25     },
    26     {
    27       path: '/seller',
    28       name: 'seller',
    29       component: seller
    30     }
    31   ]
    32 })
    View Code

    实例截图:

      

  • 相关阅读:
    位运算
    方法重载
    基本数据类型与引用数据类型参数
    带返回值方法的定义格式
    return使用
    方法的通用格式
    方法定义的格式
    google chrome developer tools
    Skolelinux
    ajax
  • 原文地址:https://www.cnblogs.com/Christeen/p/6479735.html
Copyright © 2011-2022 走看看