[Vuejs]-My prop array isn't setting my data array value

0👍

✅

The values of the <v-select>.v-model must exactly match (including its type) the values found in <v-select>.items[]. The initialroutes[] values are numbers, so the values in <v-select>.items must also be numbers.

You probably have string values for items[].RouteID:

[
  { sRoute: 'A', RouteID: '1' },
  { sRoute: 'B', RouteID: '2' },
  { sRoute: 'C', RouteID: '3' },
  { sRoute: 'D', RouteID: '4' },
]

…which don’t exactly match up to the numbers found in initialroutes[] ([1,2]).

You can either convert initialroutes[] to strings, or items[].RouteID to numbers:

[
  { sRoute: 'A', RouteID: 1 },
  { sRoute: 'B', RouteID: 2 },
  { sRoute: 'C', RouteID: 3 },
  { sRoute: 'D', RouteID: 4 },
]

demo

Leave a comment