-
-
Notifications
You must be signed in to change notification settings - Fork 245
Can't use v-model on a custom property while using nativescript-vue-template-compiler #371
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
Comments
I managed to get this to work by registerElement within my webpack config. |
@farfromrefug what do you mean by adding BTW, may this commit help on this? khawarizmus@625f456 |
@msaelices look at what I do here I use the registerElement from nativescript-vue. This is essential with vue files because XML is transformed into JSon which must already contains the model property. you can look at the computed json for NS text field to see what I am talking about. |
@farfromrefug got it. Actually, if you look at the If we use |
@rigor789 forget it. You need |
@farfromrefug So, the problem is that at compile time we are checking that if the component has been registered in order to output the regular @rigor789 what do you think is the best approach to solve it? I could work in the direction you wanted. BTW, I think with Vue 3.0 this would be probably solved by design. CC/ @yyx990803 |
@farfromrefug to let people use your hack, I've exported Waiting for a better fix by @rigor789 |
@msaelices awesome! thanks a lot. And yes a better fix is needed. I actually do the same exact thing in web pack and in my runtime. Which should not be necessary |
I have the exact same problem, attempting to register an element with model, but not able to use two-way binding with this element. |
In 2.0 we made everything a functional vue component, this unfortunately introduced an issue with v-model. I don't remember the exact issue, but will track it down and hopefully release a fix soon! |
@rigor789 looks like even with registerElement this problem still persists, cause i tried using Material Textfield and my Custom Textfield, i can't seem to get two way binding with the value of textChange instead i am getting the Nativescript Event Object. please if there is a walkaround for i will be grateful cause my validator depends on the v-model directive. Thank you |
Version
2.0.2
Reproduction link
cant be reproduced with playground
Platform and OS info
Android 7.0 / NativeScript 5.0 / Macos
Steps to reproduce
I am writing a custom native component which inherits
TextField
My model won't work because
nativescript-vue-template-compiler
does not know my custom component (isKnownView
) and thus won't handle it the right way.In my compile template i end up with this:
If i use
TextField
instead the "model" data field is not there and thus handled at runtimeHere the callback is wrong because it should be
$$v.value
instead of$$val
It is a big deal for anyone implementing custom native components like i do.
One solution would be to test for
isKnownView
at runtimeIf there is a workaround please can you tell us.
What is expected?
v-model working
What is actually happening?
v-model not working
The text was updated successfully, but these errors were encountered: