【问题标题】:Vue js child and parent componentsVue js 子组件和父组件
【发布时间】:2017-08-23 18:58:02
【问题描述】:

如何理解子组件和父组件?孩子或父母在哪里?在文档中我没有建立这个描述。请帮忙。

在下面的示例中,我只看到一个没有父或子的组件。只有一个。这是“我的组件”。等待答复。谢谢。

Vue.component("my-component", {
    template: `<li> Hello </li>`
})

new Vue({
    el: "#app"
})

<div id="app">
    <my-component> </my-component>
</div>

【问题讨论】:

    标签: vuejs2 vue-component


    【解决方案1】:

    Vue - #app 是父组件,组件 - my-component 是子组件。 里面的组件是一个孩子,很明显

    【讨论】:

      猜你喜欢
      • 2017-04-29
      • 2020-09-25
      • 2018-05-27
      • 2019-05-02
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 2020-07-26
      • 2020-11-10
      相关资源
      最近更新 更多