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

做vue的时候 ,老是有一个 warning出现,根据提示到网页看了下解决方案,因为对英语能力掌握较差,所以看来好几遍 才真正的发现自己的问题


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这个关键词,ok找到问题了 

出现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的提示链接仔细看,总能找到我们的解决方案。

另外,能吐个槽么?vue报warining的时候 要是能告诉我哪里出的 warning就好了,我可是一个一个模版翻着看呀。。。。。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值