久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      為什么使用vue的作用域插槽?什么時候使用?

      本篇文章帶大家詳細了解一下vue的作用域插槽。有一定的參考價值,有需要的朋友可以參考一下,希望對大家有所幫助。

      為什么使用vue的作用域插槽?什么時候使用?

      Vue插槽是一種將內(nèi)容從父組件注入子組件的絕佳方法。

      下面是一個基本的示例,如果我們不提供父級的任何slot位的內(nèi)容,剛父級<slot>中的內(nèi)容就會作為后備內(nèi)容。

      // ChildComponent.vue <template>   <div>      <slot> Fallback Content </slot>   </div> </template>

      然后在我們的父組件中:

      // ParentComponent.vue <template>    <child-component>       Override fallback content    </child-component> </template>

      編譯后,我們的DOM將如下所示。

      <div> Override fallback content </div>

      我們還可以將來自父級作用域的任何數(shù)據(jù)包在在 slot 內(nèi)容中。 因此,如果我們的組件有一個名為name的數(shù)據(jù)字段,我們可以像這樣輕松地添加它。

      <template>    <child-component>       {{ text }}     </child-component> </template>  <script> export default {    data () {      return {        text: 'hello world',      }    } } </script>

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號