I want to set an attribute on my component without any value. For example:
<my-button primary>Save</my-button>
I declare primaryin propsmy component:
Vue.component("my-button", {
props: ["primary"],
template: "<button v-bind:class='{primary: primary}'><slot></slot></button>"
})
Unfortunately, it does not work. The property primaryis undefined, and the class does not apply.
JSFiddle: https://jsfiddle.net/LukaszWiktor/g3jkscna/
source
share