全局组件
//DOM<tagname></tagname>//JSVue.component('tagname',{template:'html结构'});
局部组件
只有header才能用的组件var header = new Vue({el: '#header',//子组件必须声明后使用,不然不能起效components: {'组件名': 组件object,},});
组件之间的信息传递
父传子
//组件Vue.component('child', {// 声明 propsprops: {message:{type:string,//数据类型required:true,//必填default:"liu"//默认值}},data(){return{}},template: '<span>{{ message }}</span>'})//父级<child message="传递内容"></todo-item>
