vue component class binding

When properties are used on a custom component  class , these classes will be added to the component's root element. Classes that already exist on this element will not be overwritten.

For example, if you declare this component:

Vue.component('my-component', {
  template: '<p class="foo bar">Hi</p>'
})

Then add some classes when using it:

<my-component class="baz boo"></my-component>

HTML will be rendered as:

<p class="foo bar baz boo">Hi</p>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324768197&siteId=291194637