<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.的更多相关文章

  1. Ejb3 + Jboss8 出现Session id hasn't been set for stateful component

    Ejb 3 + JBoss 8  在使用客户端远程访问有状态的Ejb对象时,出现ERROR: Session id hasn't been set for stateful component 出现该 ...

  2. VUE之命令行报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead 解决办法

    Failed to compile. ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-5992 ...

  3. VUE编译报错 Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead

    背景: 在使用VUE添加标签的时候编译报错,报错如下: Component template should contain exactly one root element. If you are u ...

  4. vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one roo ...

  5. AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template

    .controller('HomeController', function($scope,$location) { $scope.userName='天下大势,为我所控!'; $scope.clkU ...

  6. Caused by: org.xml.sax.SAXParseException; systemId: file:/home/hadoop/hive-0.12.0/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well

    1:Hive安装的过程(Hive启动的时候报的错误),贴一下错误,和为什么错,以及解决方法: [root@master bin]# ./hive // :: INFO Configuration.de ...

  7. which had no Root Element. This likely means the XML is malformed or missing

    今天按照古月老师的步骤,想在RViz中配置插件. 按步骤做下来后,一运行,出现如下错误: [E[ERROR] [1523370744.057263390]: Skipping XML Document ...

  8. maven web项目的web.xml报错The markup in the document following the root element must be well-formed.

    maven项目里面的web.xml开头约束是这样的 <?xml version="1.0" encoding="UTF-8"?> <web-a ...

  9. Possible overdraw: Root element paints background @drawable/happy with a theme that also paints a background (inferred theme is @style/AppTheme)

    安卓界面插入背景图片,当图片内存太大时,界面在切换时会加载失败,这是什么原因呢?这是设置android:background属性时发出的warning: Possible overdraw: Root ...

  10. [React] Write a stateful Component with the React useState Hook and TypeScript

    Here we refactor a React TypeScript class component to a function component with a useState hook and ...

随机推荐

  1. Windows防病毒Defender 排除病毒误报

    开发的软件安装后,windows上提示病毒,默默被系统删除了. 一开始以为是自己软件的签名问题,后面发现,将被隔离的文件还原,文件的签名是存在的. 这是微软denfender的误报,为啥会报病毒呢? ...

  2. [Opencv-C++] 2. Opencv入门

    一.显示图像 从磁盘加载并在屏幕上显示一幅图像的简单Opencv程序 //Example 2-1. A simple OpenCV program that loads an image from d ...

  3. 如何用 KMP 偏序 Z 函数

    KMP 算法求解字符串匹配的过程中 \(next\) 数组有着繁多的应用,主要是可以帮我们求 border. 然而用 \(s\) 串匹配 \(t\) 串产生的 \(f\) 数组应用相对较少. \(f\ ...

  4. Prism Sample 17-BasicRegionNavigation

    本例是基础的导航应用 在窗口中布局了2个按钮,一个区域 <DockPanel LastChildFill="True"> <StackPanel Orientat ...

  5. 带大小写忽略的Replace

    #region 以下函数用于忽略大小写替换操作 public static string Replace(string Expression, string Find, string Replacem ...

  6. Ubuntu下串口工具 PicoCOM 的使用和时间戳显示

    PICOCOM Ubuntu下的串口软件, 除了 CuteCOM, screen, MiniCOM 以外, 还有一个和 MiniCOM 很像的 PicoCOM. 最近在调试 CH340C 串口的过程中 ...

  7. ModuleNotFoundError: No module named 'flask_mail'

    ModuleNotFoundError: No module named 'flask_mail' 解决: pip install flask_mail

  8. 记录-开发WPF项目中的一个疑惑

    背景 项目技术栈:C#,WPF当前我想要实现点击某个按钮就可以跳转到某个界面,翻阅了项目中的代码,看到了 // 按钮事件 private void Btn_Click(object sender, R ...

  9. 7-8 切分表达式——写个tokenizer吧 (20 分)

    1.题目描述: [先说点出题背景] 这个题是为低年级同学.学C语言的同学准备的,因为,对这部分同学,这个题目编写起来略有一点复杂.如果是高年级.学过了正则表达式(Regular Expression) ...

  10. (亲测有效-专门解决Mac环境)Pycharm 解决无法打开的问题

    前提是Mac 安装了PyCharm.app 1.第一步:先输入: cd /Applications/PyCharm.app/Contents/MacOS 2.第二步:查看无法打开pycharm的原因, ...