vue-mixin-data-attributes
1.0.3 • Public • Published vue-mixin-data-attributes
Reads data-
attributes from the element and assigns them to the Vue instance/component.
You can use the mixin on components and as global mixin. See mixin documentation.
<my-message data-message="This is OK"></my-message>
import dataAttributes from 'vue-mixin-data-attributes';
Vue.component('my-message', {
mixins: [dataAttributes],
data: () => {
return {
message: 'Default message',
},
},
mounted() {
console.log(this.message);
}
});
Installation
npm install vue-mixin-data-attributes
Package Sidebar
Install
npm i vue-mixin-data-attributes
Weekly Downloads