Pim van Die, VI Company
Vue 🚀Vue is a progressive framework for building user interfaces.
vm, for view model a high level, components are custom elements that Vue’s compiler attaches behavior to
Vue instanceVue instance
Vue.component('my-custom-component', {
mounted() {
//
},
});
// component definition
const myComponent = {
mounted() {
//
},
};
// usage in an instance
new Vue({
components: {
my-custom-component': myComponent,
},
});
Demo
Vue instance / componentdata to childpropdata, prop changes in child *propsA child component needs to explicitly declare the props it expects to receive using the props optionDocs
* Two different type of props: dynamic & static
props or data
// Component JS
data() {
return {
firstName: 'Bertus',
lastName: 'Stijgerpijp',
};
},
computed: {
fullName() {
return `${this.firstName} ${this.lastName}`;
},
},
// HTML
{{ fullName }}