原文:Vue -->Error compiling template: Component template requires a root element, rather than just text.

报了个错误,根据意思来理解就是说,template模板编译错误,组件模板需要一个根元素而不仅仅是个文本 然后我想到了template模板是需要一个根元素就像这样 这个div就是需要的根元素,我写了的啊,显然不是这个的问题,想了好久后面那句话: 不仅仅是个文本 什么意思 在这里我是通过标签的id temp 将模板绑定到组件的示例里面的 那么为什么它会认为我给它的是个文本而不是一个模板呢,仔细一看原 ...

2021-04-11 20:32 0 323 推荐指数:

查看详情

vue error:The template root requires exactly one element.

error:[vue/valid-template-root] The template root requires exactly one element. 原因: 因为vue的模版中只有能一个根节点,所以在<template>中插入第二个元素就会报错 解决方案 ...

Wed Sep 19 23:22:00 CST 2018 0 1474
Vue:The template root requires exactly one element.的解决办法

这是因为vue的模版中只有能一个根节点,所以在<template>中插入第二个元素就会报错 解决方案: 将<template>中的元素用一个大的 包起来,这样就可以在其中添加多个元素了,可以参考以下示例: 例子如下 ...

Wed Dec 15 05:29:00 CST 2021 0 1631
Vue:The template root requires exactly one element.的解决办法

这是因为vue的模版中只有能一个根节点,所以在<template>中插入第二个元素就会报错 解决方案: 将<template>中的元素用一个大的<div>包起来,这样就可以在其中添加多个元素了,可以参考以下示例: ...

Thu Jan 28 08:09:00 CST 2021 0 612
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM