src\store\modules\user.js
actions中
this.$message.error(res.msg);
报错user.js:111 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'error') at Store.loginIn (user.js:111:1)
修改方法:
import Vue from 'vue';
Vue.prototype.$message.error(res.msg);

文章讲述了在user.js的actions模块中,尝试使用Vue的$message.error方法时遇到TypeError:无法读取undefined的error属性。提供了解决方案,即在Vue原型上重新定义$message.error方法以处理错误情况。
4930

被折叠的 条评论
为什么被折叠?



