原文: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菜鸟一枚,下载github上的代码来框架和思路,添加自己新的代码调试的时候,发现了一个错误,,具体报错如: error in . src components page Test.vue Emitted value instead of an instance of Error Vue template syntax error: Component template should cont ...

2017-04-14 13:57 11 54179 推荐指数:

查看详情

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
v-for和v-if一起使用时的坑:The 'XXX' expression inside 'v-for' directive should be replaced with a computed property that returns filtered array instead. You

目的:Vue - ElementUI中循环渲染表格,控制字段的显示与隐藏 v-ifv-for同时使用。 在Vue中使用v-for循环一个数组/对象时,如果再使用v-if,那么会提示使用计算属性(能正常使用),因为Vue中是不提倡v-for与v-if同时使用的。在我的项目中也遇到了问题,不过翻看 ...

Sat Jan 22 18:38:00 CST 2022 1 2729
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