[Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance

warning如下:

[Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance:

在warnign下面有個(gè)鏈接
http://vuejs.org/guide/components.html#Fragment_Instance

點(diǎn)進(jìn)去直接找fragment instance這個(gè)關(guān)鍵詞

出現(xiàn)fragment instance有多種情況
There are multiple conditions that will turn a Vue instance into a fragment instance:

  1. Template contains multiple top-level elements. (模版包涵了多個(gè)頂級(jí)元素 說白了 你的模版元素沒有唯一一個(gè)父元素)
  2. Template contains only plain text.(模版里面只包涵純文本)
  3. Template contains only another component (which can potentially be a fragment instance itself).(模版只包含另外一個(gè)組件,而這個(gè)組件本上可以就是一個(gè)fragment instance)
  4. Template contains only an element directive, e.g. <partial> or vue-router’s<router-view>.(模版只包含<partial>或者<router-view>組件 )
  5. Template root node has a flow-control directive, e.g. v-if or v-for.(模版根節(jié)點(diǎn)被v-if活著v-for有個(gè)邏輯判斷)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容