当运行vue出现错误Component template should contain exactly one root element. If you ...的时候,我们只需要将<template>标签中的代码包裹到<div>标签中即可。


报错代码

点击查看代码
<template>
<h1>Hello World</h1>
</template>

改为这样才不会报错

点击查看代码
<template>
<div class='hello'>
<h1>Hello World</h1>
</div>
</template>

Vue出现Component template should ...的更多相关文章

  1. "[Vue warn]: Failed to mount component: template or render function not defined"错误的解决

    VUE中动态路由出错: vue.esm.js?a026: [Vue warn]: Failed to mount component: template or render function not ...

  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. vue之component

    因为组件是可复用的 Vue 实例,所以它们与 new Vue 接收相同的选项,例如 data.computed.watch.methods 以及生命周期钩子等.仅有的例外是像 el 这样根实例特有的选 ...

  6. [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

    转载自:https://segmentfault.com/a/1190000006435886 解决办法:添加package.config.js配置文件中,添加本文章的红色部分代码 import vu ...

  7. Vue学习笔记 template methods,filters,ChromeDriver,安装sass

    ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.80 ...

  8. vue19 组建 Vue.extend component、组件模版、动态组件

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. vue & child component & props

    vue & child component & props vue pass data to child component https://vuejs.org/v2/guide/co ...

随机推荐

  1. 定制卡牌式 banner

    HTML <template> <view > <swiper class='swiperClass' autoplay interval="2000" ...

  2. 【uniapp 开发】文字缩略css

    文字超出两行后显示省略号 display: -webkit-box; overflow: hidden; text-overflow: ellipsis; word-wrap: break-word; ...

  3. PAT A1001 A+B Format

    Calculate a+b and output the sum in standard format -- that is, the digits must be separated into gr ...

  4. Python输出数字金字塔

    使用Python输出一个数字金字塔 运行结果: 源代码: ''' Python输出数字金字塔 ''' for x in range(1,10): print(' '*(15-x),end='') n= ...

  5. 使用 NIO 搭建一个聊天室

    使用 NIO 搭建一个聊天室 前面刚讲了使用 Socket 搭建了一个 Http Server,在最后我们使用了 NIO 对 Server 进行了优化,然后有小伙伴问到怎么使用 Socket 搭建聊天 ...

  6. python---变量、常量、注释、基本数据类型

    变量 变量:将运算的中间结果暂存到内存中,以便后续程序调用. 变量的命令规则: 变量由字母.数字.下划线组合而成. 不可以数字开头,更不能全是数字. 不能是python的关键字. 不要用中文. 名字要 ...

  7. pod和容器(容易混淆的地方)

    在Kubenetes中,所有的容器均在 pod 中运行,一个pod可以承载一个或者多个相关的docker容器(或rkt,以及用户自定义容器),同一个Pod中的容器可以部署在同一个物理机器(可以叫宿主机 ...

  8. 【Example】C++ STL 常用容器概述

    前排提醒: 由于 Microsoft Docs 全是机翻.所以本文表格是我人脑补翻+审校. 如果有纰漏.模糊及时评论反馈. 序列式容器 序列容器是指在逻辑上以线性排列方式存储给定类型元素的容器. 这些 ...

  9. Python 康德乐大药房网站爬虫,使用bs4获取json,导入mysql

    自学两天,写个low点的爬虫代码.自己获取商品价格接口的过程,使用软件 Fiddler 进行抓包进行分析.调用接口进行异常判断

  10. 微信小程序一些标签

    wxml标签   一.视图容器(View Container): 二.基础内容(Basic Content) 标签名 说明 标签名 说明 view 视图容器 icon  图标 scroll-view ...