hamed-ehtesham / pretty-checkbox-vue

Quickly integrate pretty checkbox components with Vue.js
MIT License
261 stars 31 forks source link

class p-default is incorrectly added when using only :class special bind #35

Open liqueurdetoile opened 4 years ago

liqueurdetoile commented 4 years ago

Hi,

When using only special class bind prop, the mounted hook doesn't detect that some classes have been provided and automatically apply p-default class. Therefore, some animations are disabled.

Here's a repro link : https://codepen.io/liqueurdetoile/pen/wvvZVaE

marcosrocha85 commented 4 years ago

Isn't that a pretty checkbox issue itself? Not from pretty checkbox vue?

liqueurdetoile commented 4 years ago

@marcosrocha85 Nope. Issue is in mounted hook :

if (this.$vnode.data && !this.$vnode.data.staticClass)
                this.default_mode = true;

It only check for static classes to fallback on p-default class. It should also check for binded classes. I think this one could do the trick :

if (this.$vnode.data && !this.$vnode.data.staticClass && !this.$vnode.data.class)
                this.default_mode = true;