-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support for v-model
directive
#25
Comments
I haven't looked at the implemetation in runtime-dom - but I would like to be able to specify the model information in The syntax would be similar to 2.x with model: {
prop: 'value',
event: 'valueChange'
} And perhaps the ability to add "transforms" that can transform the values from the events - as they are not always using Edit: (I just saw that's the first task in this list - oops) |
@rigor789 I've just read your comment, but I guessed well I think. Please check out the last commits in the |
@msaelices looks good! The idea of adding a transformer for the models is not actually needed, as the event that listens for the change already uses |
@msaelices added support for |
@rigor789 Awesome! |
Hi @rigor789 , I've read on one of the another issue/feature thread that you has not been motivated to spend more time on this project to move things forward, really sorry to hear it. But want to say that with release of Nativescript 7 and Vue.js 3 a lot of web developers trying to check it together and your effort is appreciated. |
I've found how to make v-model work in template tag if anyone interested. You can create functional component like below for example: const withVModel = (node: VNode, arg: any, mods?: any) => withDirectives(node, [[vModel, arg, '', mods]]);
const BaseInput: FunctionalComponent<BaseInputInterface> = (props, context) => {
let value: string | number = '';
let { modelModifiers } = props;
return h(
withVModel(
h('TextField', {
'onUpdate:modelValue': (v: string | number) => {
value = v;
},
}),
value,
modelModifiers
),
context.attrs,
context.slots
);
};
export default BaseInput; Then in SFC import it and use with v-model directive, for example
|
model: {prop: string, event: string}
to theNSVViewMeta
interfacevModel
infrastructure, which consumes the previousmodel
TextField
support(Label can't be "edited" so i doesn't need vModel, just simple one way bindings)Label
Tabs
TabView
BottomNavigation
DatePicker
ListPicker
Progress
SearchBar
SegmentedBar
Slider
Switch
TextView
TimePicker
The text was updated successfully, but these errors were encountered: