提问人:Ahmet 提问时间:11/16/2023 更新时间:11/16/2023 访问量:36
Nuxt 3 PyCharm IDE 的“Vue:找不到名称计算”错误
Nuxt 3 'Vue: Cannot find name computed' error for PyCharm IDE
问:
我正在用Nuxt 3开发一个学习基础知识的项目。我正在使用 PyCharm IDE 并遇到了问题。
问题描述:
const userName = computed(() => store.user.name)
在我的 Vue 组件中,当我使用 computed 属性(或 ref、reactive、onMounted 等)时,PyCharm 会在将鼠标悬停在 computed 上时显示:Vue: Cannot find name computed
当我手动从“vue”导入计算时,这个问题得到了解决,但据我了解,这在 Nuxt 3 中应该是不必要的,它会自动导入这些 API。import { computed } from 'vue'
当前 tsconfig.json
配置:
{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"strict": true,
"types": ["@nuxt/types", "@types/node"],
"jsx": "preserve",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"skipLibCheck": true
},
"include": ["**/*.ts", "**/*.d.ts", "**/*.tsx", "**/*.vue"],
"exclude": ["node_modules"]
}
尝试解决:
- 确保 Vue 插件在 PyCharm 中是最新的(PyCharm 也是)。
- 使 PyCharm 中的缓存/重启失效。
- 使用清理纱线缓存删除并重新安装依赖项
尽管做出了这些努力,但问题仍然存在。我怀疑问题可能与 tsconfig.json 配置或 PyCharm 如何解释 Vue 3/Nuxt 3 项目有关。
如何配置 PyCharm 或我的项目设置来识别 Vue 3 功能,例如计算,而无需在 Nuxt 3 项目中显式导入它们?有关如何解决此问题的任何见解或建议将不胜感激。
先谢谢你!
尝试解决:
- 确保 Vue 插件在 PyCharm 中是最新的(PyCharm 也是)。
- 使 PyCharm 中的缓存/重启失效。
- 使用清理纱线缓存删除并重新安装依赖项
答: 暂无答案
评论