Category - 小程序

2019-11-14 07:46:41    21    0    0
## 小程序运行机制 [文档](https://developers.weixin.qq.com/miniprogram/dev/framework/operating-mechanism.html) 小程序启动 小程序启动会有两种情况,一种是「冷启动」,一种是「热启动」。 热启动:假如用户已经打开过某小程序,然后在一定时间内再次打开该小程序,此时无需重新启动,
2019-11-14 07:46:41    6    0    0
## 1. App上挂globalData ### App.js App({ globalData: { name: '前端学者', // ...other globalData }, // ...other globalData }); // 取值 var n
2019-11-14 07:46:41    8    0    0
## **注意: 小程序需要先上线才能生成二维码** ## **另参考[官方文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542)** ## **另参考[扫普通链接二维码打开体验版小程序](https://developers.weixin.qq.com/miniprogram/introduction/qrcode.html#%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B)** ## 1. **获取[access_token](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183)** ### 接口调用请求说明 ``` https请求方式: GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET ``` ### 参数说明 参数|是否必须|说明 :-: | :-: | :-: grant_type|`是`|获取`access_token`填写`client_credential` appid|`是`|第三方用户唯一凭证 secret|`是`|第三方用户唯一凭证密钥,即`appsecret` 以下是Oauth支持的5类 grant_type 及说明 ``` authorization_code 授权码模式(即先登录获取code,再获取token) password 密码模式(将用户名,密码传过去,直接获取token) client_credentials 客户端模式(无用户,用户向客户端注册,然后客户端以自己的名义向’服务端’获取资源) implicit 简化模式(在redirect_uri 的Hash传递token; Auth客户端运行在浏览器中,如JS,Flash) refresh_token 刷新access_token ``` ### 返回说明 ``` {"access_token":"ACCESS_TOKEN","ex
2019-11-14 07:46:41    19    0    0
2019-11-14 07:46:41    14    0    0
## **canvas画图ctx.drawImage()图片在真机上不显示** - 网络图片记得使用`wx.drawImage`或者`wx.downloadFile`下载下来使用临时路径 - **如果本地图片和网络图片下载下来了还是不能显示, 查看``的宽高必须是有值**