You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.5 KiB

// pages/index/index.js
//引入SDK核心类
var QQMapWX = require('../../libs/qqmap-wx-jssdk.js')
var qqmapsdk
Page({
onLoad: function() {
//实例化API核心类
qqmapsdk = new QQMapWX({
key: '2Y2BZ-ABTA7-5UMXN-HCB7R-XZIWO-FGB3C'
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
//调用接口
qqmapsdk.search({
keyword:'酒店',
success:function (res) {
console.log(res)
},
fail: function(res) {
console.log(res)
},
complate: function(res) {
console.log(res)
}
})
},
//makers标记点
markers: {
iconPath: "/resources/others.png", //图标资源路径
id: 0, //标记点id
latitude: 23.099994, //纬度
longitude: 113.324520, //经度
width: 50, //图标宽度
height: 50 //图标宽度
},
//controls设置
controls: [{
id: 1,
iconPath: '../../images/banner.png',
position: {
left: 0,
top: 10,
width: 375,
height: 71
},
clickable: true
}]
})
wx.getSystemInfo({
success: function(res) {
console.log(res.model) //手机型号
console.log(res.pixelRatio) //设备像素比
console.log(res.windowWidth) //可使用窗口宽度
console.log(res.windowHeight) //可使用窗口高度
console.log(res.language) //微信设置的语言
console.log(res.version) //微信版本号
console.log(res.platform) //客户端平台
}
})