Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2018/08/21 记录今天遇到的路由BUG #29

Open
ChenPt opened this issue Aug 20, 2018 · 0 comments
Open

2018/08/21 记录今天遇到的路由BUG #29

ChenPt opened this issue Aug 20, 2018 · 0 comments
Labels
VUE Vue相关问题

Comments

@ChenPt
Copy link
Owner

ChenPt commented Aug 20, 2018

Vue-Router 设置动态路由匹配,会根据路由所定义的顺序来匹配。
假如路由配置如下

const router = new VueRouter({
  routes: [
    {
      path: '/user/:id'
    },
    {
      path: '/user/apply'
    }
  ]
})

遇到路由为/user/xxx格式的,永远只会匹配到/user/:id,不会匹配到/user/apply,即使路由是/user/apply,将后者写在前者前面,就会在匹配不到apply的时候再去匹配动态路由。

@ChenPt ChenPt added the VUE Vue相关问题 label Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VUE Vue相关问题
Projects
None yet
Development

No branches or pull requests

1 participant