v-selectpage icon indicating copy to clipboard operation
v-selectpage copied to clipboard

v-model is not updating the value

Open quantumass opened this issue 3 years ago • 1 comments

Bug

The v-model didn't work the value would disappear after I click on the option, I tried so many things with no success here is an example https://codesandbox.io/s/heuristic-cookies-q48ez9

Solution

After banging my head against the wall I discovered that the data should not be computed value I was doing

<v-selectpage
  v-model="selectedClientId"
  :data="options.map(el => ({
      name: el.name,
      id: String(el.id)
    }))"
  placeholder=" "
  title=" "
/>

I should do

<v-selectpage
  v-model="selectedClientId"
  :data="options"
  key-field="id" 
  show-field="name"
  placeholder=" "
  title=" "
/>

quantumass avatar Jul 19 '22 17:07 quantumass

In your examples case, only need to remove .map(...) content

<v-selectpage
  v-model="selectedClientId"
  :data="options"
  placeholder=" "
  title=" "
>
</v-selectpage>

TerryZ avatar Jul 20 '22 01:07 TerryZ