zoukankan      html  css  js  c++  java
  • [Vue @Component] Place Content in Components with Vue Slots

    Vue's slots enable you to define where content of a component should land when you define the content inside of a parent component. You can also name slots to arrange the elements however you'd like and allow your component to build it's own content around the content that will be placed.

    main.js:

    import Vue from 'vue'
    import App from './App.vue'
    
    
    new Vue({
      render: (h) => (
        <App>
        <h1 slot="header">This is header</h1>  
        <h2 slot="footer">This is footer</h2>  
      </App>
      )
    }).$mount('#app')

    App.vue:

    <template>
      <section class="section">
          <slot name='header'></slot>
    
         <hello-world message="Message from APP"></hello-world>
      
         <slot name='footer'></slot>
      </section>
    </template>
  • 相关阅读:
    day32-python阶段性复习六
    golang 项目中坑
    golang crawler
    router
    golang in ubuntu
    go channel 案例分析
    go channel learning
    bee go + mgo
    URL escape and unescape
    [转]good sample of Go
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9350937.html
Copyright © 2011-2022 走看看