data: {
},
showHello:
function () {
this.setData({ msg:
"Hello World" })
},
getPosition:
function(){
wx.getLocation({
type:
'wgs84',
success: (res) => {
var latitude = res.latitude
// 经度
var longitude = res.longitude
// 纬度
console.log(latitude);
console.log(longitude);
}
})
},
getScanCode:
function () {
wx.scanCode({
success: (res) => {
console.log(res)
}
})
},
markertap:
function(){
wx.getLocation({
type:
'wgs84',
success: (res) => {
var latitude = res.latitude
// 经度
var longitude = res.longitude
// 纬度
this.setData({ lo: longitude })
this.setData({ la: latitude })
}
})
},
<!--pages/test/test.wxml-->
<
text
bindtap=
'showHello'>aaaaaa{{msg}}
</
text
>
<
button
bindtap=
'getPosition'>position
</
button
>
<
button
bindtap=
'getScanCode'>scan
</
button
>
<
map
longitude=
"37.49794"
latitude=
"40"></
map
>
var helloData={
name:
'Tom'
}
Page({
changeName:
function(){
this.setData({
name:
'tomm'
})
}
})
<!--pages/test/test.wxml-->
<
view
>Hello{{name}}
</
view
>
<
button
bindtap=
'changeName'>click me
</
button
>