var Bmob = require( '../../utils/bmob.js' );
var app = getApp();
Page({
data: {
longitude: "" ,
latitude: "" ,
controls: [{
iconPath: '/images/address.png' ,
position: {
left: (app.globalData.windowWidth / 2) - 20,
top: (app.globalData.windowHeight - 40) / 2 - 38,
width: 40,
height: 40
}
},
{
id: 1,
iconPath: '/images/positioning.png' ,
position: {
left: 20,
top: 20,
width: 40,
height: 40
},
clickable: true
}
]
},
staticData: {
latitude: "" ,
longitude: ""
},
onShow() {
this .getLocation();
},
onReady: function (e) {
var that = this ;
this .mapCtx = wx.createMapContext( 'Map' )
},
getLocation(e) {
var that = this ;
wx.getLocation({
type: 'gcj02 ' ,
success(res) {
that.staticData.longitude = res.longitude,
that.staticData.latitude = res.latitude
}
})
},
controltap() {
this .mapCtx.moveToLocation()
},
onShareAppMessage() {
return {
title: '萌宠交易平台' ,
path: '/page/index/index'
}
}
});
|
能做成代码片段吗?
https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html
不好意思,刚刚自己解决了问题
好哦