微信小程序相关
(1)定位选择:
<picker mode="region" bindchange="bindRegionChange" value="{{region}}">
<icon type="download" size="16" />
</picker>
bindRegionChange: function (e) {
this.setData({
addressInfo: e.detail.value.join(''),
region: e.detail.value
})
}
wx.getLocation({ type: 'wgs84', success: function (res) { var longitude = res.longitude; var latitude = res.latitude; wx.request({ url: 'https://apis.map.qq.com/ws/geocoder/v1?key=6M5BZ-L6XW4-S2TU7-D4DFU-547ZJ-UNBLU&location=' + latitude + ',' + longitude + '&output=json&pois=0', data: {}, method: 'GET', success: function (res) { if (res.statusCode === 200 && res.data.status === 0) { let loc = res.data.result.ad_info; let addressInfo = []; addressInfo.push(loc.province); addressInfo.push(loc.city); addressInfo.push(loc.district); that.setData({ addressInfo: addressInfo.join(''), region: addressInfo }); } } }); } });
(2)h5页面跳小程序:
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
if (window.__wxjs_environment === 'miniprogram') {
wx.ready(function() {
wx.miniProgram.navigateTo({url: '/page/pack-main/pages/eduDetails/eduDetails?id=' + course_id+'&activity_id='+activity_id});
});
}
(3)对于微信扫一扫:wx.scanCode({})
andorid是可以直接调用的,IOS不可以直接调用。
解决办法:按钮事件点击调用