error:[vue/valid-template-root]

The template root requires exactly one element.

原因:

因为vue的模版中只有能一个根节点,所以在<template>中插入第二个元素就会报错

解决方案:

将<template>中的元素先用一个<div>包起来。

<template><div><p>123</p><p>456</p></div>
</template>

  

本文转载于:猿2048https://www.mk2048.com/blog/blog.php?id=hjchaa&title=vue error:The template root requires exactly one element.

vue error:The template root requires exactly one element.相关推荐

  1. 【Vue.js 3.0】不使用根标签,Error:[vue/no-multiple-template-root] The template root requires exactly one ...

    [vue/no-multiple-template-root]The template root requires exactly one element.eslint-plugin-vue 原因分析 ...

  2. The template root requires exactly one element(总算是解决)

    为了在vscode中编写的代码看起来规范,肯定要使用全局的ESLint配置 一.在VS Code中添加ESLint插件 二.在node全局路径中生成 eslint 的配置文件 .eslintrc.js ...

  3. The template root requires exactly one element.

    template中只允许模板里存在一个根节点,在 template 中添加一个 标签,之后所有的组件全部加在 . <template><div class = "" ...

  4. Vue3 VSCode新建项目报错The template root requires exactly one element.

    1.首先我们点击左侧第四个图标插件 2.输入框搜索vetur插件 3.点击设置图标,再点击扩展设置 4.搜素vetur>validation>template,取消vetur>val ...

  5. vue报错:the template root disallows ‘v-for‘ directives解决办法

    原代码: <template><div v-for="(item, index) in apps" :key="index"> {{ i ...

  6. 页面报错[Vue warn]: Error compiling template

    页面上报错:[Vue warn]: Error compiling template 最终检查是因为: 出现的原因是把新建的实例放在了被绑定的组件当中 div 中有script <div id= ...

  7. vue Syntax Error Error PostCSS plugin postcss-pxtorem requires PostCSS 8

    vue Syntax Error: Error: PostCSS plugin postcss-pxtorem requires PostCSS 8. Migration guide for end- ...

  8. SpringBoot(二)Error resolving template “xxx”, template might not exist or might not be accessible解决办法

    SpringBoot 7 SpringBoot整合持久层技术 7.1 整合JDBC 7.1.1 修改pom文件 <?xml version="1.0" encoding=&q ...

  9. Error:This Gradle plugin requires Studio 3.0 minimum

    导入一个demo提示Error:This Gradle plugin requires Studio 3.0 minimum 在gradle.properties中导入 android.injecte ...

最新文章

  1. rpc框架都有哪些_这六种微服务RPC框架,你知道几个?
  2. ok6410 3.0.1内核调用V4L接口出错解决方法(转)
  3. 电子科大电气工程导师介绍绍_电子科技大学计算机科学与工程学院研究生导师介绍:葛树志...
  4. python idle退出_【ZZ】windows+python2.7在IDLE中执行sys.exit()出现的问题及解决方案
  5. 17行html代码实现的将网页文本保存成本地文本文件
  6. python基础知识-8-三元和一行代码(推导式)
  7. 嵌入式WiFi芯片价格战已经打响 MCU企业该醒悟了
  8. 日志转化成json格式
  9. android的动态注册,Android JNI 函数注册的两种方式(静态注册/动态注册)
  10. Leetcode每日一题:514.freedom-trail(自由之路)
  11. 第一篇:centos7下svn的安装与卸载
  12. rsync定时同步备份
  13. 一份神奇的礼物(1)
  14. 简单的开源日志Log4D delphi 6---delphi xe 10全可用
  15. 化龙小型汽车考场手动挡C1科三考试技巧
  16. Python根据字幕文件自动给视频添加字幕
  17. 如何将pdf文件压缩变小?
  18. pip安装faiss
  19. java交通调度,java毕业设计_springboot框架的的车辆调度管理系统
  20. Godot着色器基础

热门文章

  1. 数据结构之排序五:选择排序
  2. 如何设置Linux操作系统shell命令的默认语言
  3. 【BZOJ1069】【SCOI2007】—最大土地面积(凸包+旋转卡壳)
  4. Python 位操作运算符
  5. vue数组中对象属性变化页面不渲染问题
  6. FreeRTOS--API函数
  7. jQuery data
  8. 为什么单例模式是邪恶的(译)
  9. hibernater面试一
  10. Ph.D Grind 阅读感想 By 张雄