Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UToggle give wrong status onClick() #1113

Closed
hoanghadu opened this issue Dec 17, 2023 · 8 comments · Fixed by #1560
Closed

UToggle give wrong status onClick() #1113

hoanghadu opened this issue Dec 17, 2023 · 8 comments · Fixed by #1560
Labels
bug Something isn't working

Comments

@hoanghadu
Copy link

hoanghadu commented Dec 17, 2023

Environment


  • Operating System: Linux
  • Node Version: v20.8.0
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: pnpm@8.6.11
  • Builder: -
  • User Config: ssr, devtools, modules, extends, colorMode, routeRules, vuefire
  • Runtime Modules: @nuxt/ui@2.11.0, @nuxt/content@2.9.0, nuxt-vuefire@0.3.1, @nuxt/image@1.0.0-rc.3, @nuxthq/studio@1.0.5, @vueuse/nuxt@10.7.0, @nuxtjs/color-mode@3.3.2
  • Build Modules: -

Version

v2.11.1

Reproduction

<script setup>
const selected = ref(false)
function checkStatus() {
  console.log(selected.value)
}
</script>

<template>
  <UToggle v-model="selected" @click="checkStatus()" />
</template>

Description

The @change doesn't work.
@click give the wrong status of the variable

@hoanghadu hoanghadu added the bug Something isn't working label Dec 17, 2023
Copy link
Member

The change event was indeed missing, thanks for the report! 😊

The click will never work for sure, you'd better watch the selected value instead.

@hoanghadu
Copy link
Author

hoanghadu commented Dec 23, 2023

Please implement @change event in next release. Thank you 🙇‍♂️

Copy link
Member

It has been done in 4c84839

@Sadhill94
Copy link

I do not get the @change event emitted, seems like it has been added, but not on set()

set (value) {
emit('update:modelValue', value)
emitFormChange()
}

Copy link
Member

Why not watch the selected ref?

@Sadhill94
Copy link

Sadhill94 commented Mar 21, 2024

It's a possibility but since i saw that the @change was actually added in the release (4c84839) that's why i've tried to listen to it but it never fires

Copy link
Member

benjamincanac commented Mar 25, 2024

@Sadhill94 This will be fixed by #1560. It was my mistake, the emitFormChange wasn't emitting an actual change event but used only to forward to the form bus.

@Sadhill94
Copy link

Thank you and thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants