vue3报错:‘defineProps‘ is not defined,‘defineExpose‘ is not defined
今晚在使用Vue3开发的时候报了以下错误:‘defineExpose’ is not defined‘defineProps’ is not defined‘defineEmits’ is not definedno-undef‘withDefaults’ is not definedno-undef百度了一下发现有人说在eslint的规则里加rules: {"no-undef": "off"},
·
今晚在使用Vue3开发的时候报了以下错误:
‘defineExpose’ is not defined
‘defineProps’ is not defined
‘defineEmits’ is not defined no-undef
‘withDefaults’ is not defined no-undef
百度了一下发现有人说在eslint的规则里加
rules: {
"no-undef": "off"
},
但这个规则把所有未定义的变量的错误都屏蔽了,不是最优的解决方案,最后查了官网,发现官网建议这样:
但加**“vue/setup-compiler-macros”: true** 之后又报了另外一个错误:
最终发现是eslint和eslint-plugin-vue的版本问题
最后我把版本更新为
yarn add eslint@7.32.0
yarn add eslint-plugin-vue@8.0.0
就完美解决了
更多推荐
已为社区贡献1条内容
所有评论(0)