gpt4 book ai didi

typescript - Vue 3 模板根只需要一个 element.eslint-plugin-vue

转载 作者:行者123 更新时间:2023-12-03 15:19:38 26 4
gpt4 key购买 nike

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

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
我试过放
    "vue/no-multiple-template-root": 0
在我的 .eslintrc.js 中
但错误仍然存​​在。我怎样才能摆脱错误?因为在 Vue 3 中,模板中不必只有一个元素。
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
}
};

最佳答案

我最终关闭了 Vetur linting。 Vetur 认为它是一个 Vue 2 项目,因为它位于 VS Code 工作区中。
https://github.com/vuejs/vetur/issues/2299#issuecomment-696015374
你可以通过这样做来解决这个问题

F1>Preferences:Open Settings (JSON)
粘贴
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": false,

关于typescript - Vue 3 模板根只需要一个 element.eslint-plugin-vue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64867504/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com