一.全局组件

<div >
    {{msg}}
    <my-aaa></my-aaa>
</div>
var Home = { 
    template: '<div >test</div>'
}
Vue.component("my-aaa", Home)

  

二.局部定义

<div >
    {{msg}}
    <my-aaa></my-aaa>
</div>
var Home = {
    template: '<div >test2</div>'
}
new Vue({
    el: "#box",
    data: {
        msg: "welcome vue2.0"
    },
    components: {
        "my-aaa": Home
    }
})

  

相关文章:

  • 2021-08-04
  • 2021-11-28
  • 2021-07-18
  • 2021-12-13
  • 2021-12-20
猜你喜欢
  • 2021-12-05
  • 2021-09-02
  • 2022-12-23
  • 2021-10-12
  • 2021-06-19
  • 2022-12-23
相关资源
相似解决方案