我需要在微信小程序webview中调用 微信扫一扫功能!
1,业务域名已经配了
2,签名也生成了
3,白名单也加了
为什么还是报config:fail,invalid url domain这个错误,微信小程序的webview网页调用应该不需要服务号相关配置吧,请帮忙看一下,微信小程序公众平台中我还需要配置一些什么才能满足要求
console.log('response:', response.data)
const nonceStr = that.generateNonceStr() // 随机字符串
const timestamp = new Date().getTime() // 时间戳
const url = window.location.href.split('#')[0] // 当前网页url
const str =
'jsapi_ticket=' +
response.data +
'&noncestr=' +
nonceStr +
'×tamp=' +
timestamp +
'&url=' +
url
console.log('str:', str)
const signature = that.sha1(str) // sha1加密
let config = {
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: this.APPID, // 必填,公众号的唯一标识
timestamp: timestamp, // 必填,生成签名的时间戳
nonceStr: nonceStr, // 必填,生成签名的随机串
signature: signature, // 必填,签名
jsApiList: ['scanQRCode'] // 必填,需要使用的JS接口列表
}
console.log('config :', config)
wx.config(config)
