radix-vue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
3.51k stars 203 forks source link

[Bug]: Select/SelectItem does not call function @click #608

Closed nktll closed 2 weeks ago

nktll commented 2 weeks ago

Reproduction

https://stackblitz.com/edit/8cdayc-hk7izh?file=src%2FApp.vue

Describe the bug

Hey guys, recently Select component stopped calling a function on SelectItem click once you select an option. Tried to reinstall component, but it didn't help. Not sure what happened, if this is related to the library or Radix, but I hope I can get help here.

Code example

<Select>
  <SelectTrigger class="w-[120px] bg-white">
    <SelectValue :placeholder="activePrimaryCurrency" />
  </SelectTrigger>
  <SelectContent>
    <SelectGroup>
      <SelectItem v-for="(item,index) in currencies" :value="item" @click="handleChoice(index)">
        {{item}}
      </SelectItem>
    </SelectGroup>
  </SelectContent>
</Select>

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M2
    Memory: 161.98 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    npm: 9.5.1 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.5
  npmPackages:
    @vueuse/core: ^10.7.0 => 10.10.0
    nuxt: ^3.9.3 => 3.11.2
    radix-vue: ^1.2.4 => 1.8.3
    shadcn-nuxt: ^0.1.0 => 0.1.0
    vue: ^3.3.4 => 3.4.27

Contributes

sadeghbarati commented 2 weeks ago

Why not use the latest radix-vue? Why do you stay on 1.2.4?

sadeghbarati commented 2 weeks ago

@nktll I saw the Stackblitz demo you are not using it right, read radix-vue docs carefully

you can use v-model to get selected item, selecting item value is automatically done when you clicking on SelectItem component

https://www.radix-vue.com/components/select.html

nktll commented 5 days ago

Thanks guys!