• +91 9723535972
  • info@interviewmaterial.com

Vue JS Interview Questions and Answers

Question - What is dynamic route matching?

Answer -

Sometimes it may be required to map routes to the same component based on a pattern.

Let's take a user component with the mapped URLs like /user/john/post/123 and /user/jack/post/235 using dynamic segments,

const User = {
  template: '
User {{ $route.params.name }}, PostId: {{ route.params.postid }}
'
}

const router = new VueRouter({
  routes: [
    // dynamic segments start with a colon
    { path: '/user/:name/post/:postid', component: User }
  ]
})

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners