zoukankan      html  css  js  c++  java
  • 微信小程序 --- 获取当前坐标

    获取位置:get.location 

    type:wgs84(是全球定位系统,获取的坐标,gcj02是国家测绘局给出的坐标)

    btnclick:function(){
        wx.getLocation({
            type:'wgs84',// 默认wgs84
            success:function(res){},
            fail:function(res){},
            complete:function(){}
        });
    }

    查看位置:有两个

    第一个:wx.chooseLocation:可以打开地图进行选择,之后返回给 complete 

    btnclick:function(){
        wx.getLocation({
            success:function(res){
                var latitude = res.latitude;
                var longitude = res.longitude;
                wx.chooseLocation({
                    latitude = latitude,
                    longitude = longitude,
                    success:function(res){
                        console.log(res);
                    },
                    fail:function(){},
                    complete:function(){}
                });
            }
        });
    }

    第二个:wx.openLocation:使用微信内置地图查看位置

    btnclick:function(){
        wx.getLocation({
            success:function(res){
                var latitude = res.latitude;
                var longitude = res.longitude;
                wx.openLocation({
                    latitude = latitude,
                    longitude = longitude,
                    scale:28
                });
            }
        });
    }
  • 相关阅读:
    14-补充内容:MySQl创建用户和授权
    15-可视化工具Navicat的使用
    11-数据的增删改
    12-单表查询
    09-完整性约束
    10-外键的变种 三种关系
    07-数据类型
    08-数据类型(2)
    Mysql 基本语法
    E. K-periodic Garland
  • 原文地址:https://www.cnblogs.com/e0yu/p/8489700.html
Copyright © 2011-2022 走看看