zoukankan      html  css  js  c++  java
  • Cannot read property 'matched' of undefined"

    错误代码 D:workspacexxxsrcmain.js

    const routes = new VueRouter({
      routes: [
        {
          path: '/apple',
          component: Apple
        },
        {
          path: '/banana',
          component: Banana
        }
      ]
    })
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      routes,
      template: '<App/>',
      components: { App }
    })
    

      

    正确代码1

    const router = new VueRouter({
      routes: [
        {
          path: '/apple',
          component: Apple
        },
        {
          path: '/banana',
          component: Banana
        }
      ]
    })
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      router,
      template: '<App/>',
      components: { App }
    })
    

      

    正确代码2

    const routes = new VueRouter({
      routes: [
        {
          path: '/apple',
          component: Apple
        },
        {
          path: '/banana',
          component: Banana
        }
      ]
    })
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      router: routes,
      template: '<App/>',
      components: { App }
    })
    

      

    错误分析: router才是合法参数,缩写的时候要注意。

      




    另外 path: './apple',  应该是path: '/apple'

    const routes = new VRouter({
      routes: [
        {
          path: './apple',
          component: Apple
        },
        {
          path: './banana',
          component: Banana
        }
      ]
    })
    

      

  • 相关阅读:
    判断是否IPv6网络
    Makefile使用库
    Makefile编译
    Makefile编译库
    lua定义一个简单的类
    c++ 注册类到 lua
    redis的安装
    yield return的作用
    使用boost的asio,io_service无法初始化
    apache+php+mysql的配置(转载)
  • 原文地址:https://www.cnblogs.com/tabCtrlShift/p/9162510.html
Copyright © 2011-2022 走看看