vue一些笔记

官网给出的方法

router.js

export default new Router({
  // mode: 'history', 
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component: layout,
    },
    {
      path: '/header/:id',
      name: 'header',
      component: header,
  }

提醒: 测试当使用history模式的时候,监听会失效
然后使用官网给出的方法,在header上面监听即可
可用于父子组件的监听和动态路由匹配之间的监听,传递参数等

posted on 2019-09-22 22:58  2481  阅读(113)  评论(0编辑  收藏  举报

导航