Home > OS >  VueJs route match params only from list (Validate params value)
VueJs route match params only from list (Validate params value)

Time:11-16

The route should be resolved only for the given params list (Validate params)

e.g. valid names ["Sam", "Alice"]

//route 
{
  path: "/customers/:names"  
}

// expectation 

path = /customers/Sam   => matched 
path = /customers/Alice => matched 
path = /customers/XYZ   => Not matched 
path = /customers/ABC   => Not matched 

How this can be achieved ??

CodePudding user response:

You can use enter image description here

Here is a video on how it actually looks

enter image description here


PS: here is a working github repo (if needed).

  • Related