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

Addon-Docs: Handle class attributes in Dynamic Source Rendering for Vue.js #13327

Merged
merged 2 commits into from Nov 29, 2020

Conversation

pocka
Copy link
Contributor

@pocka pocka commented Nov 29, 2020

Issue: fix #13326 (no autoclose)

What I did

Handle Vue.js class and :class attributes in Dynamic Source Rendering.

How to test

  • Is this testable with Jest or Chromatic screenshots? ... Yes, added some tests
  • Does this need a new example in the kitchen sink apps? ... No
  • Does this need an update to the documentation? ... No

If your answer is yes to any of these, please make sure to include it in your PR.

#13326

Both static class (`class="foo"`) and dynamic class (`:class="..."`)
are ignored because Vue treats them as special attribute. They don't
exist in normal vnode.data.attrs nor componentOptions.propsData.
@pocka pocka changed the title fix(addon-docs): render Vue classes in dynamic source Addon-Docs: Handle class attributes in Dynamic Source Rendering for Vue.js Nov 29, 2020
@pocka pocka marked this pull request as draft November 29, 2020 03:28
@pocka
Copy link
Contributor Author

pocka commented Nov 29, 2020

Converted to Draft because forgot to support object-in-array syntax (https://vuejs.org/v2/guide/class-and-style.html#Array-Syntax)

https://vuejs.org/v2/guide/class-and-style.html#Array-Syntax

Add support for below.

```vue
<div v-bind:class="[{ active: isActive }, errorClass]"></div>
```
@pocka
Copy link
Contributor Author

pocka commented Nov 29, 2020

Converted to Draft because forgot to support object-in-array syntax (https://vuejs.org/v2/guide/class-and-style.html#Array-Syntax)

Done!

@pocka pocka marked this pull request as ready for review November 29, 2020 03:52
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests 💯

@shilman shilman added this to the 6.1.x milestone Nov 29, 2020
@shilman shilman merged commit b747c5c into next Nov 29, 2020
@shilman shilman deleted the pocka/fix/vue-dynamic-source-class-missing branch November 29, 2020 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants