vue3+js使用elementplus的ElMessage弹窗报错:ElMessage‘ is not defined.eslintno-undef
文章目录
- 报错内容
- 解决方案
报错内容
‘ElMessage’ is not defined.eslintno-undef
runtime-core.esm-bundler.js:453 Uncaught ReferenceError: ElMessage is not defined
at Proxy.resetForm (index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/basic/component.vue?vue&type=script&lang=js:90:7)
at onClick._cache.._cache. (index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/basic/component.vue?vue&type=template&id=0150519c&scoped=true:332:67)
at callWithErrorHandling (runtime-core.esm-bundler.js:387:19)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:394:17)
at emit (runtime-core.esm-bundler.js:5828:5)
at eval (runtime-core.esm-bundler.js:7301:45)
at handleClick (use-button.mjs:73:5)
at callWithErrorHandling (runtime-core.esm-bundler.js:387:19)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:394:17)
at HTMLButtonElement.invoker (runtime-dom.esm-bundler.js:932:83)
解决方案
原代码:
ElMessage.info('表单已重置');
改成elementui的写法就行
this.$message('表单已重置');
展示效果:
您好,我是肥晨。
欢迎关注我获取前端学习资源,日常分享技术变革,生存法则;行业内幕,洞察先机。