步骤 1先创建一个组件对象
ar MyComp = {
template:`<div>这是局部组件</div>`
}
步骤 2 .把这个对象注册到实例 或者 组件上成为组件使用
通过组件或者实例的 components这个选项上,以key值为组件名称
var vm = new Vue({
components:{
MyComp
}
}).$mount('#app')
步骤 3 .使用这个实例后者组件的环境中 (template 中 )就可以 使用这个组件
子组件.png