-
Notifications
You must be signed in to change notification settings - Fork 24
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
Usage with NativeScript-Vue #29
Comments
Hey @gigioSouza , sadly I'm not a Vue developer so i cannot help you on this. I think best to ask on SO so you can get more audience and an appropriate answer. |
Hi, you need to register the component in your main.js file Vue.registerElement('MaskedTextField',
() => require('nativescript-masked-text-field').MaskedTextField
); then, use in your vue component <MaskedTextField
v-model="cpf"
mask="999.999.999-99"
keyboardType="phone"
/> |
@Gabrielr2508 It "worked", the app compiled and I'm able to use the |
@gigioSouza The mask works here, but v-model doesn't. Can't figure out why not. :( |
I tried to bind the "text" property of the field and update it in the textchange event, but this caused me to not be able to change the text in the emulator |
I was able to get the value using a refs property and in function it retrieves the value this way $ refs.refName.nativeView.text |
Hey JS ERROR TypeError: Could not load view for: maskedtextfield. TypeError: view_1.CSSType is not a function. (In 'view_1.CSSType("MaskedTextField")', 'view_1.CSSType' is undefined) I have registered the component using Vue.registerElement('MaskedTextField',
() => require('nativescript-masked-text-field').MaskedTextField
); Then I just add it to the page and when I do I get the error. <MaskedTextField
v-model="email"
mask="999.999.999-99"
keyboardType="phone"
/> I am super new to Vue and Nativescript som I have no idea what I do wrong. |
@andreaskvibydialect , make sure you are using Nativescript 4 or later. The CSSType was added relatively recent 😃 |
Hey |
That is correct. |
Hey |
Sadly I'm not a Vue developer so can't help much with the registration and other Vue stuff... |
I understand, me neither but if you hear or see some NativeScript-Vue App that makes it possible to get this component to work please let me know. |
Try the following: I just tried the package and it worked. |
hei i got this plugin working on vue nativescript this on my main.js this on my component page and who still use ns-vue 1.3.1 version, u should to edit your package.json then run finally hope that helps :) |
v-model doesn't seem to work, anyone with same behaviour and how to fix it? |
The textfield is not even showing up for me (tns 5.3.4)... |
Same for me, it does not show up
Från: Jonarod <[email protected]>
Svara till: PeterStaev/nativescript-masked-text-field <[email protected]>
Datum: fredag 31 maj 2019 09:35
Till: PeterStaev/nativescript-masked-text-field <[email protected]>
Kopia: Andreas Kviby <[email protected]>, Mention <[email protected]>
Ämne: Re: [PeterStaev/nativescript-masked-text-field] Usage with NativeScript-Vue (#29)
The textfield is not even showing up for me (tns 5.3.4)...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#29?email_source=notifications&email_token=ALIN32VOAW7NSTIXGTXX3STPYDIKTA5CNFSM4GCWOX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWUOL3Q#issuecomment-497608174>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALIN32SJ3DF7QS3MBU6LUB3PYDIKTANCNFSM4GCWOX6Q>.
|
In order for v-model to work, you will need to specify which property/event to use, like this: Vue.registerElement(
'MaskedTextField',
() => require('nativescript-masked-text-field').MaskedTextField,
{
model: {
prop: 'text',
event: 'textChange'
}
}
); Check this example: https://play.nativescript.org/?template=play-vue&id=3Rac7h&v=3 |
@bundyo helped me out from th slack forum. Now it works. Vue.registerElement(
'MaskedTextField',
() => require('nativescript-masked-text-field').MaskedTextField,
{
model: {
prop: 'text',
event: 'textChange'
}
}
); but then also in my <template>
<MaskedTextField mask="99/99" v-model="expiryDate" />
</template>
<script>
import {MaskedTextField} from "nativescript-masked-text-field" // REMOVE THIS
export default {
components: {MaskedTextField}, // REMOVE THIS
data(){
return {
expiryDate: ''
}
}
}
</script> |
@Jonarod Thanks that helped once again. |
Even with @bundyo answer it is still not working for me. |
How to add v-model to this. |
I ended up using |
I ended up using the following code snippet to workaround the v-model issue:
Hopefully this helps! |
Hi, I am getting this error when trying to load the app with MaskedTextField. Did the same as suggested by @bundyo.
|
I'm new to NativeScript and I'm starting with Vue, how do I use it with NativeScript-Vue?
I tested like this, but got no result
The text was updated successfully, but these errors were encountered: