报错:Property or method "then" is not defined on the instance

来源:5-18 Modal交互补充

xmhua

2021-06-24

点购物车图标,提示框显示,
点击关闭按钮或查看购物车按钮,提示框关闭了,但报错:Property or method “then” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

图片描述

写回答

4回答

河畔一角

2021-06-26

main.js中37行改成Vue.prototype.axios=axios

这是原型挂载,Vue-axios插件有问题

0
3
xmhua
老师,npm install之后,问题已解决,不知道是什么原因,哈哈,谢谢
2021-06-28
共3条回复

xmhua

提问者

2021-06-25

main.js:

//img.mukewang.com/szimg/60d553f00983672305310928.jpg

package.json

//img.mukewang.com/szimg/60d5536f096dbc6805080458.jpg


index.vue用了this.axios.get().then的地方:

//img.mukewang.com/szimg/60d5536f09fff70406010697.jpg


0
0

xmhua

提问者

2021-06-25

Modal.vue的代码

//img.mukewang.com/szimg/60d546c5096ac35b07420571.jpg

//img.mukewang.com/szimg/60d546c509c1055b08880542.jpg


0
0

河畔一角

2021-06-24

检查你哪个地方用到了then方法,我只能告诉你这个警告提示的是then找不到,因为你没有贴代码

0
4
xmhua
回复
河畔一角
上传了main.js,index.vue用了this.axios.get().then的图片,谢谢老师!
2021-06-25
共4条回复

Vue全家桶实战 从零独立开发企业级电商系统

Vue全家桶构建企业级电商系统,真实服务端数据对接,高实用性

2560 学习 · 1307 问题

查看课程