warning如下:
[Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance:
在warnign下面有個鏈接
http://vuejs.org/guide/components.html#Fragment_Instance
點進(jìn)去直接找fragment instance這個關(guān)鍵詞
出現(xiàn)fragment instance有多種情況
There are multiple conditions that will turn a Vue instance into a fragment instance:
- Template contains multiple top-level elements. (模版包涵了多個頂級元素 說白了 你的模版元素沒有唯一一個父元素)
- Template contains only plain text.(模版里面只包涵純文本)
- Template contains only another component (which can potentially be a fragment instance itself).(模版只包含另外一個組件阶捆,而這個組件本上可以就是一個fragment instance)
- Template contains only an element directive, e.g. <partial> or vue-router’s<router-view>.(模版只包含<partial>或者<router-view>組件 )
- Template root node has a flow-control directive, e.g. v-if or v-for.(模版根節(jié)點被v-if活著v-for有個邏輯判斷)