美文网首页
[Vue warn]: Attribute "id&q

[Vue warn]: Attribute "id&q

作者: penggelies07 | 来源:发表于2016-07-25 13:59 被阅读84次

    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

    点进去直接找fragment instance这个关键词

    出现fragment instance有多种情况
    There are multiple conditions that will turn a Vue instance into a fragment instance:

    1. Template contains multiple top-level elements. (模版包涵了多个顶级元素 说白了 你的模版元素没有唯一一个父元素)
    2. Template contains only plain text.(模版里面只包涵纯文本)
    3. Template contains only another component (which can potentially be a fragment instance itself).(模版只包含另外一个组件,而这个组件本上可以就是一个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.(模版根节点被v-if活着v-for有个逻辑判断)

    相关文章

      网友评论

          本文标题:[Vue warn]: Attribute "id&q

          本文链接:https://www.haomeiwen.com/subject/ssigjttx.html