html - Vue 错误 : "the template root requires exactly one element"

标签 html vue.js

我有以下组件

组件

<template>
<!--<post-form/>-->
    <div class="wrapper">
        <b-table :data="posts">
            <template slot-scope="props">
                <b-table-column field="completed" label="complete">
                    <b-checkbox 
                      v-model="props.row.done">
                    </b-checkbox>
                </b-table-column>
            </template>
        </b-table>
    </div>
</template>

我有一个带有 buefy 的 b-table。我想导入 <post-form />来自当前组件的组件。

但是,当我将组件插入所需位置时,出现错误。

<div class="wrapping">如果我在它下面放置一个组件,我的 table 就会坏掉。

我该如何解决这个问题?

最佳答案

也许你正在使用 Vue3,而你的 eslint 配置仍然是 vue 2。

尝试编辑您的 .eslintrc.json 或类似这样的内容:

{
  // ...
  "extends": ["eslint:recommended", "plugin:vue/vue3-essential"],
  // ...
}

在此处查看引用资料:eslint-plugin-vue/#usage

关于html - Vue 错误 : "the template root requires exactly one element",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56199405/

相关文章:

javascript - 垂直添加元素时如何防止背景图像在移动浏览器上缩放?

javascript - JQuery scroll()/scrollTop() 在 IE 或 Firefox 中不工作

javascript - 如何将组件作为 prop 传递给 Vue.js 中的另一个组件

php - 使用 Laravel Mix 编译时出错 - Vue

php - Vue.js 没有正确更新 URL

vue.js - 我可以在 Bootstrap-vue 表中删除带有 sr-only 类的 span 元素吗?

html - 停止 CSS 动画

HTML 导航栏缩放页面而不是移动内容

javascript - 用户输入规则后,如何在 div 中动态应用 css 规则

javascript - 创建方法中的异步/等待 - Vue 2