原文: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