首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Vue 3模板根只需要一个元素。eslint-plugin-vue

Vue 3模板根只需要一个元素。eslint-plugin-vue
EN

Stack Overflow用户
提问于 2020-11-17 08:04:42
回答 8查看 21.9K关注 0票数 16

在搭建了一个Vue 3项目后,我注意到我的App.vue中出现了一个错误。

代码语言:javascript
运行
复制
A functional component that renders the matched component for the given path. Components rendered in can also contain its own , which will render components for nested paths.

API Reference

[vue/no-multiple-template-root]
The template root requires exactly one element.eslint-plugin-vue

我试着把

代码语言:javascript
运行
复制
"vue/no-multiple-template-root": 0

在我的.eslintrc.js中

但是错误仍然存在。我怎样才能摆脱这个错误呢?因为在Vue 3中,一个模板中不需要只有一个元素。

代码语言:javascript
运行
复制
module.exports = {
    root: true,
    env: {
        node: true
    },
    extends: [
        "plugin:vue/vue3-essential",
        "eslint:recommended",
        "@vue/typescript/recommended",
        "@vue/prettier",
        "@vue/prettier/@typescript-eslint"
    ],
    parserOptions: {
        ecmaVersion: 2020
    },
    rules: {
        "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
        "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
        "vue/no-multiple-template-root": 0
    }
};
EN

Stack Overflow用户

发布于 2021-01-06 17:58:16

检查

代码语言:javascript
运行
复制
 vscode-> plugins-> close Vetur 

重新启动vscode,然后打开Vetur。

有关更多信息,请查看下面的链接:https://github.com/vuejs/eslint-plugin-vue/issues/1297#issuecomment-755202013

票数 -4
EN
查看全部 8 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64867504

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档