Vue.js 3模板-文本错误无法读取属性';范围';空的

Vue.js 3模板-文本错误无法读取属性';范围';空的,vue.js,eslint,vuejs3,dynamic-import,async-components,Vue.js,Eslint,Vuejs3,Dynamic Import,Async Components,我正在尝试在Vue.js中动态导入异步组件 从“vue”导入{defineAsyncComponent}; 常量分量='lorem-ipsum-4'; 导出默认值{ 名称:'文章', 组成部分:{ MyAsync:defineAsyncComponent(()=>import(`@/articles/${component}.vue`), }, }; 导出默认值{ 名称:'文章', 组成部分:{ MyAsync:defineAsyncComponent(()=>import('@/arti

我正在尝试在Vue.js中动态导入异步组件


从“vue”导入{defineAsyncComponent};
常量分量='lorem-ipsum-4';
导出默认值{
名称:'文章',
组成部分:{
MyAsync:defineAsyncComponent(()=>import(`@/articles/${component}.vue`),
},
};
导出默认值{
名称:'文章',
组成部分:{
MyAsync:defineAsyncComponent(()=>import('@/articles/'+component+'.vue')),
},

};在由
/
组成的路径上替换
@

export default {
  name: 'Article',
  components: {
    MyAsync: defineAsyncComponent(() => import(`./articles/${component}.vue`)),
  },
};

它对我有效

经过一些调试后,我发现它是一个,为了解决它,我将文件
.eslintrc
添加到项目根目录中,并包含以下内容:

{
    "plugins": [
        "vue"
      ],
    "rules" : {
        "template-curly-spacing": ["error", "never"]
      }
}

与他写的差不多,但你的答案是非ES6变体(模板Literals)。谢谢你的回答。你知道为什么模板文本在这里不起作用吗?我在其他地方没有遇到任何问题。还有,你为什么认为这不好?@LordBo模板文字应该像这里提到的那样工作。让我们来看看。谢谢你的回答。不幸的是,这对我来说没有任何改变。太好了,你真的做到了!我想接受你的回答,但不幸的是,它不符合我的设置。我在上找到了正确的语法。您是将.eslintrc添加到我上载到github的示例项目中,还是创建了一个新项目?我克隆了您的项目,并添加了包含上述内容的
.eslintrc
文件及其工作表,然后我将接受它。对于任何在之后出现linting问题的人,我建议使用上面linke中的配置以及这个答案中的附加规则。