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

Issues with Deactive and active methods #29

Open
david-saint opened this issue Dec 15, 2018 · 0 comments
Open

Issues with Deactive and active methods #29

david-saint opened this issue Dec 15, 2018 · 0 comments

Comments

@david-saint
Copy link

david-saint commented Dec 15, 2018

The prop visible won't function properly once the deactive method has been called

Steps to reproduce

<button @click="() => modalVisible = true">open modal</button>

<card-modal :visible="modalVisible" @cancel="() => modalVisible = false"> sdklfjsda </card-modal>

data() { return { modalVisible: false }

This would work only when you click the button and the cancel button. When you click the close button the deactive method in the BaseModal Mixin is called, and all it does is set the show to false.
Since the show and the modalVisible are meant to be in sync, the next time you click on the button modalVisible would remain true but show would be false.

if I change the click function of the button to toggle the state of modalVisible, I would have to click 2 times to get the modal back to visible.

The temporary fix is adding ref to the modal

<button @click="() => $refs.modal.active()">open modal</button>

<card-modal ref="modal" :visible="modalVisible" @cancel="() =>$refs.modal.deactive()"> sdklfjsda </card-modal>

Which makes the :visible prop somewhat useless.

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

1 participant