- 小程序跳转到h5后,h5如何跳转会小程序?
@官方 h5跳转回小程序,官方文档是这样写的, [代码]<!-- html -->[代码][代码]<script type=[代码][代码]"text/javascript"[代码] [代码]src=[代码][代码]"https://res.wx.qq.com/open/js/jweixin-1.3.2.js"[代码][代码]></script>[代码] [代码]// javascript[代码][代码]wx.miniProgram.navigateTo({url: [代码][代码]'/path/to/page'[代码][代码]})[代码][代码]wx.miniProgram.postMessage({ data: [代码][代码]'foo'[代码] [代码]})[代码][代码]wx.miniProgram.postMessage({ data: {foo: [代码][代码]'bar'[代码][代码]} })[代码][代码]wx.miniProgram.getEnv([代码][代码]function[代码][代码](res) { console.log(res.miniprogram) [代码][代码]// true })[代码]但是https://www.w3cschool.cn/weixinkaifawendang/h8ap1qe5.html里面显示,必须要配置 [代码]wx.config({[代码][代码] [代码][代码]debug: [代码][代码]true[代码][代码], [代码][代码]// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。[代码][代码] [代码][代码]appId: [代码][代码]'wx218745d3a97a41e5'[代码][代码], [代码][代码]// 必填,公众号的唯一标识[代码][代码] [代码][代码]timestamp: [代码][代码]''[代码][代码], [代码][代码]// 必填,生成签名的时间戳[代码][代码] [代码][代码]nonceStr: [代码][代码]''[代码][代码], [代码][代码]// 必填,生成签名的随机串[代码][代码] [代码][代码]signature: [代码][代码]''[代码][代码],[代码][代码]// 必填,签名,见附录1[代码][代码] [代码][代码]jsApiList: [] [代码][代码]// 必填,需要使用的JS接口列表,所有JS接口列表见附录2[代码][代码] [代码][代码]});[代码]才可以,请问到底需要什么样的步骤?直接 wx.miniProgram 是 undefined,有的是 config,ready 这些 function
2018-07-04 - Cant find variable:at request fail call
1. result is not defined;at App post function;at api request fail callback function 2. Can't find variable: result;at pages/home/home requestHomeData function;at api request fail callback function 后台发现好多这种错误,都是 result is not defined at api request fail callback function,但是相应的 method 里面并没有任何 result,而且我确定所有的 result 都做了空判断,官方能指点指点吗? pages/home/home requestHomeData function: [代码]requestHomeData: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.login({[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]res.code && app.post(Url.home, {city: that.data.currentCityName, code: res.code}).then(res => {[代码][代码] [代码][代码]res.data && that.handleHomeData(res.data);[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码] App post function: [代码]/**[代码][代码] [代码][代码]* 封装 post 请求为 Promise[代码][代码] [代码][代码]* @param url[代码][代码] [代码][代码]* @param data[代码][代码] [代码][代码]* @param header[代码][代码] [代码][代码]* @returns {*|Promise<any>}[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]post: [代码][代码]function[代码] [代码](url, data, header = {}) {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].globalData.deviceSerialNumber) {[代码][代码] [代码][代码]header = {...header, [代码][代码]'device-serial-number'[代码][代码]: [代码][代码]this[代码][代码].globalData.deviceSerialNumber};[代码][代码] [代码][代码]}[代码][代码] [代码][代码]return[代码] [代码]url && data && [代码][代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: url,[代码][代码] [代码][代码]method: [代码][代码]'POST'[代码][代码],[代码][代码] [代码][代码]data: data,[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/json'[代码][代码], [代码][代码]// 微信默认就是[代码][代码] [代码][代码]...header[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]resolve(res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]reject(res);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码]
2018-06-07