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
        }
      ]
    })
    

      

  • 相关阅读:
    状压DP
    string
    hdu3068
    HDU Stealing Harry Potter's Precious(状压BFS)
    状压BFS
    BFS+打印路径
    poj Meteor Shower
    C语言-无符号数与有符号数不为人知的秘密
    keras_实现cnn_手写数字识别
    python_plot画图参数设置
  • 原文地址:https://www.cnblogs.com/tabCtrlShift/p/9162510.html
Copyright © 2011-2022 走看看