Cannot use v-for on stateful component root element because it renders multiple elements.
Posted 胸怀丶若谷
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot use v-for on stateful component root element because it renders multiple elements.相关的知识,希望对你有一定的参考价值。
<template name:trailerStars> <image v-for="yellow in yellowScore" src="../static/icos/star-yellow.png" class="star-ico"> </image> <image v-for="gray in grayScore" src="../static/icos/star-gray.png" class="star-ico"> </image> </template>
错误原因:
不能在根元素(root element)使用 v-for,因为v-for是个循环体呈现多个元素,v-for在根元素上导致无法渲染。
解决方案:
将元素包裹到另外的标签中:
<template name:trailerStars> <view> <image v-for="yellow in yellowScore" src="../static/icos/star-yellow.png" class="star-ico"> </image> <image v-for="gray in grayScore" src="../static/icos/star-gray.png" class="star-ico"> </image> </view> </template>
参考链接:https://blog.csdn.net/hua_ban_yu/article/details/80256611
以上是关于Cannot use v-for on stateful component root element because it renders multiple elements.的主要内容,如果未能解决你的问题,请参考以下文章
如何解决 Xcode 错误消息 'url' instance member cannot be used on type 'view controller'
TypeError: cannot use a string pattern on a bytes-like object
SwiftUI:Cannot use mutating member on immutable value: ‘self‘ is immutable
SwiftUI:Cannot use mutating member on immutable value: ‘self‘ is immutable
[Functional Programming] Transition State based on Existing State using the State ADT (liftState, co
python3写爬虫报错--------TypeError: cannot use a string pattern on a bytes-like object