• <abbr id="chdyf"></abbr>
    <ruby id="chdyf"><acronym id="chdyf"><meter id="chdyf"></meter></acronym></ruby>
    <bdo id="chdyf"></bdo>
    <dfn id="chdyf"><menu id="chdyf"></menu></dfn>
    1. <menuitem id="chdyf"></menuitem><strong id="chdyf"><menu id="chdyf"></menu></strong>

      <rt id="chdyf"><menu id="chdyf"></menu></rt>
      成人小说一区二区三区,伊人精品成人久久综合全集观看,久久HEZYO色综合,中文字幕精品人妻熟女,影音先锋成人网站,我要看免费一级毛片,中国女人做爰A片,中文字幕av久久爽Av

      inheritAttrs和$attrs的使用

      2019-12-26    seo達人

      禁用繼承屬性inheritAttrs和$attrs的使用

      Index.html:



      <div id="app">

              <test-input

               v-bind:class="class1"

               v-bind:style="{fontSize:17+'px'}"

               v-bind:test1='test1'

               test2="test2"

               placeholder="placeholder test3"

              ></test-input>

          </div>



      Index.js:



      Vue.component('test-input', {

        inheritAttrs: false,

        template: &lt;label &gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;p v-bind="$attrs"&gt;測試&lt;/p&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input&nbsp; v-bind="$attrs"&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/label&gt;

      })

      new Vue({

        el:'#app',

        data:{

          class1:'class1note',

          test1:'test1note',

          test2:'test2note',

      },

      })



      頁面結果:



      當將屬性修改為:inheritAttrs: true,的時候

      頁面的結果:



      包含了所有的屬性:



      最后總結:

      當inheritAttrs的屬性值為true(不寫該行屬性的結果同true,也就是inheritAttrs默認為true),組件的根元素會自動繼承所有的屬性!當為false的時候,根元素只會繼承注冊的屬性,自建的屬性不會繼承!!

      attrs:它包含了父組件所有的自建屬性!可以通過v?kind=“ attrs:它包含了父組件所有的自建屬性!可以通過v-kind=“attrs:它包含了父組件所有的自建屬性!可以通過v?kind=“attrs”將所有自建屬性賦給想要的元素上!!




      日歷

      鏈接

      個人資料

      藍藍設計的小編 http://m.wtxcl.cn

      存檔