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

Toggling binded class causes classes that were added on a custom directive to get removed #11556

Closed
hafezdivandari opened this issue Aug 2, 2020 · 2 comments

Comments

@hafezdivandari
Copy link

Version

2.6.11

Reproduction link

https://jsfiddle.net/hafez/nobjg618/

Steps to reproduce

  1. define a custom directive that adds a class to element's class list.
  2. use this defined directive on an element and toggle a random class via v-bind:class

What is expected?

Static classes of the element and classes that are added on directive should stay untouched.

What is actually happening?

When toggling a dynamic class, all classes added on directive get removed.

@posva
Copy link
Member

posva commented Aug 2, 2020

This is expected behavior: Vue cannot detect the dynamically added classes so you should either add all the classes manually in JS or use Vue to handle it.


Remember to use the forum or the Discord chat to ask questions!

@posva posva closed this as completed Aug 2, 2020
@hafezdivandari
Copy link
Author

@posva is it documented anywhere?

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