微信小程序 this.setData is not a function
来源:互联网 发布:数控剪板机编程 编辑:程序博客网 时间:2024/05/17 07:03
在一般的函数中:
bindFaChange1: function (e) { console.log('picker发送选择改变,携带值为', e.detail.value) this.setData({ index1: e.detail.value }) }
this.setData是正确的。
但当在函数中有个请求(wx.request)时:
formSubmit: function (e) { wx.request({ method: 'POST', header: header, url: url, dataType: 'json', success: function (res) { this.setData({ data1: true }) } })}
这样会报错误:this.setData is not a function.
解决方法就是 :在请求(wx.request)外面添加:var that=this;将success中的
this.setData({ data1: true })
改为:
that.setData({ data1: true })
阅读全文
0 0
- 微信小程序 this.setData is not a function
- 微信小程序 报错:this.setData is not a function
- 微信小程序 this.setData is not a function
- 微信小程序 this.setData is not a function
- 微信小程序 this.setData is not a function;父元素获取
- 小程序之坑一TypeError: this.setData is not a function
- 论微信小程序的坑:thirdScriptError TypeError: this.setData is not a function
- 微信小程序 is not a function
- ExtJs this.addevents is not a function
- this.setState is not a function
- 微信小程序之this.setData
- extjs中出现this.addevents is not a function错误
- extjs中出现this.addevents is not a function错误
- Ext.this.addEvents is not a function错误
- Ext this.addEvents is not a function错误原因
- Extjs中this.swf.setDataProvider is not a function解决办法
- Ext this.addEvents is not a function 错误原因
- Extjs 报this.addEvents is not a function错误原因
- Spring_定时器配置
- PHP session 跨子域问题总结
- BZOJ 4627: [BeiJing2016]回转寿司 cdq
- 设计模式--策略模式
- mybatis中各个表签的作用
- 微信小程序 this.setData is not a function
- window7 系统 设置 显示隐藏文件 文件扩展名
- 爬虫实例(中国大学排名前10)
- 【2017.11.16】外包单报价
- ubuntu16.04 安装
- STM32-1-LED点亮与熄灭
- Java判断一个数的取值范围和类型。
- ES6-数组的扩展-数组实例的fill()
- 在 sysservers 中找不到服务器 'IP(名字)'。请执行 sp_addlinkedserver 将该服务器添加到 sysservers。