在小程序中有一键报警功能,该功能需要使用获取位置信息功能和拨打电话功能。所以学习了获取位置信息API(wx.getLocation)查看位置(wx.openLocation)以及拨打电话API(wx.makePhoneCall)
例如wx.getLocation({type: 'wgs84',
success: function(res) {
var latitude = res.latitude
var longitude = res.longitude
var speed = res.speed
var accuracy = res.accuracy
}
})
wx.makePhoneCall({
phoneNumber: '1340000' //仅为示例,并非真实的电话号码
})