Advertisement

组件的嵌包方式

阅读量:
复制代码
    组件之间的嵌套要将子组件以标签化的形式放在父组件的模板中使用
    
    
      
    

组件全局

复制代码
    <body>
      <div id="app">
      <Father></Father> 
       <!--  
     直接这么写是不行的  //因为解析到了Father就不会继续执行了
     <Father>
      <Son></Son>
    </Father> 
       -->
      </div>
      <template id="father">
    <div>
      <h3> father </h3>
      <hr>
      <Son/>
    </div>
      </template>
      <template id="son">
    <h5> son </h5>
      </template>
    </body>
    <script src="../../../lib/vue.js"></script>
    <script>
      /* 组件之间的嵌套要将子组件以标签化的形式放在父组件的模板中使用 */
      Vue.component('Father',{
    template:

全部评论 (0)

还没有任何评论哟~