123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view>
- <cu-custom :bgColor="NavBarColor" :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">定位</block>
- </cu-custom>
- <map
- style="width: 100%; height:500px;"
- :latitude="latitude"
- :longitude="longitude"
- :markers="marker"
- :scale="scale"
- >
- </map>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- NavBarColor:this.NavBarColor,
- id:0,
- title: 'map',
- latitude: 40.009704,
- longitude: 116.374999,
- marker: [{
- id:0,
- latitude: 40.009704,
- longitude: 116.374999,
- iconPath: '/static/location.png',
- rotate:0,
- width:20,
- height:20,
- title:'你在哪了',
- alpha:0.5,
-
- callout:{
- content:'北京国炬公司',
- color:'#ffffff',
- fontSize:14,
- borderRadius:2,
- bgColor:'#00c16f',
- display:'ALWAYS'
- }
-
-
-
-
-
- }],
- scale:16,
- controls:[{
- id:1,
- iconPath:'/static/login3.png',
- clickable:true,
- position:{
- left:15,
- top:15,
- width:50,
- height:50
- },
- }],
- circles:[{
- latitude: 40.009704,
- longitude: 116.374999,
- radius:50,
- fillColor:"#ffffffAA",
- color:"#55aaffAA",
- strokeWidth:1
- }],
-
- }
- },
- onLoad() {
- this.getLocation()
- },
- methods: {
- getLocation(){
- uni.getLocation({
- type: 'gcj02',
- success: function (res) {
- console.log('当前位置的经度:' + res.longitude);
- console.log('当前位置的纬度:' + res.latitude);
- },
- fail: function (res) {
- console.log('当前位置的经度');
- }
- });
- }
- }
- }
- </script>
- <style>
- </style>
|