vue-router/router的配置和router-link的配合

router配置文件

import Vue from 'vue'
import Router from 'vue-router'
import index from '@/pages/index'
import fenlei from '@/pages/fenlei'

Vue.use(Router)

export default new Router({
  mode : "history",
  routes: [
    {
      path: '/',//要跳转的地址
      name: 'index',
      component: index
    },
    {
      path: '/fenlei',//要跳转的地址
      name: 'fenlei',
      component: fenlei
    }
  ]
})

跳转设置

<li><router-link tag="li" to="/"><img src="../../img/footer/shouye.jpg" alt=""><p>首页</p></router-link></li>

猜你喜欢

转载自blog.csdn.net/mlonly/article/details/88019014