1. Parent-child component, the child component is inside the parent component, and must be wrapped with a node, such as div, such as:
<div id="app">
<parent-component><parent-componnet>
</div>
<template id="parent-template">
<!---This is wrong----->
<child-component></child-component>
<!-------This is correct--------->
<div><child-component></child-component></div>
</template>
2. When using computed to redefine data, data cannot be modified. To be able to modify it, a set needs to be set in computed, such as:
/***Conventional writing is like this***/
computed:{
newItem:function(){
return this.item
}
}
/***If you want to modify it like this***/
computed:{
newItem:{
get:function(){
return this.item;
},
set:function(value){
return value
}
}
}
3. Communication between components, $emit passes the value from the child component to the parent component, the parentheses cannot have, such as:
<parent-component @save-new-item="saveNew"></parent-component>