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

Two-way binding #9

Closed
hamedg68 opened this issue Feb 29, 2024 · 3 comments
Closed

Two-way binding #9

hamedg68 opened this issue Feb 29, 2024 · 3 comments

Comments

@hamedg68
Copy link

If I want to change the v-model from out of the component, for example If the date gotten from the server, the date does not set on model-value, I think it needs to track the external changes of model-value with watch.

hamedg68 added a commit to hamedg68/vue3-persian-datepicker that referenced this issue Feb 29, 2024
@alireza-ab
Copy link
Owner

Hi @hamedg68
This is the solution: alireza-ab/vue-persian-datepicker#4 (comment)
the code example is for vue 2 but you can use it for vue 3.

@hamedg68
Copy link
Author

hamedg68 commented Mar 1, 2024

The concept of using v-model is to use on a component to implement a two-way binding at any time, if we use setDate() for setting new value, actually breaks the concept of using v-model and we can use :modelValue instead of v-model.
https://vuejs.org/guide/components/v-model.html
I have solved this issue on pull request

@alireza-ab
Copy link
Owner

You're right. I had done this wrong from the start and didn't change it. but about your PR, did you run the test cases?
I run test cases and it doesn't run correctly. Also, you change the package.json file in your PR.

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

No branches or pull requests

2 participants