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

useVModel does not work with classes #1530

Closed
7 tasks done
ghost opened this issue Apr 25, 2022 · 0 comments · Fixed by #1599
Closed
7 tasks done

useVModel does not work with classes #1530

ghost opened this issue Apr 25, 2022 · 0 comments · Fixed by #1599

Comments

@ghost
Copy link

ghost commented Apr 25, 2022

Describe the bug

When you pass a class to useVModel it emits a data object rather than an instance of the original class. The original object's prototype data does not match the prototype data on the emitted object. This seems like a bug. If it's not possible to fix, maybe we need another composable, something like useClassVModel.

See the repro.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ah9zrf?file=src/Child.vue

System Info

System:                                               
    OS: Windows 10 10.0.19043                           
    CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
    Memory: 12.39 GB / 31.79 GB                         
  Binaries:                                             
    Node: 14.17.5 - C:\Program Files\nodejs\node.EXE    
    Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 100.0.4896.127
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.50)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vueuse/core: 8.2.5 => 8.2.5
    vue: ^3.2.33 => 3.2.33

Used Package Manager

yarn

Validations

antfu pushed a commit that referenced this issue May 16, 2022
Co-authored-by: nikitamihailov <mikhaylovnv.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants