当前位置: 代码迷 >> 综合 >> VUE开发踩坑 Component template should contain exactly one root element.
  详细解决方案

VUE开发踩坑 Component template should contain exactly one root element.

热度:4   发布时间:2023-12-14 23:54:00.0

今天在学习VUE框架的时候发现了一个坑

报错为Component template should contain exactly one root element.

报错的意思为组件<template>标签下应该只能有一个直系儿子节点,所以应该在<template>标签下插入一个<div>或<p>标签作为儿子节点,然后在这些儿子节点中放入其他内容或其他自定义组件!

  相关解决方案