第一步:草料二维码编辑
草料二维码生成一个对象:如 {code:12345678}。
第二步,点击按钮扫一扫 ,只写相关代码
getScancode: function() {
var _this = this;
wx.scanCode({
success: (res) => {
let result = JSON.parse(res.result)
if(result.code){
wx.showLoading({
title: '加载中', icon: 'loading'})
_this.postCode(result.code)
}else{
wx.showModal({
title: '状态码错误',
showCancel: false
})
}
}
})
},
postCode:function(params){
let that = this
getInformation(params).then(function(res){
console.log(res)
if(res.data.status == 200){
let data = res.data.datas
that.setData({
})
wx.hideLoading()
}
})
},