// pages/material/material_details.js Page({ /** * 页面的初始数据 */ data: { latitude: "", longitude: "", deptName: "", warehouseName: "", warehouseId:"", remark: "", //标记点 markers: [{ id: 0, name: "编程小石头", latitude: 43.8691319, longitude: 125.3504459, width: 35, height: 50 }] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let details = JSON.parse(options.details) this.setData({ warehouseName:details.warehouseName, warehouseId:details.warehouseId, latitude: details.latitude, longitude: details.longitude, deptName: details.deptName, remark: details.remark, markers: [{ id: details.warehouseId, name: details.warehouseName, latitude: Number(details.latitude), longitude: Number(details.longitude), width: 35, height: 50 }] }) }, //导航 navRoad() { // console.log("%%%",event) let that=this wx.getLocation({ //获取当前经纬度 type: 'wgs84', //返回可以用于wx.openLocation的经纬度, success: function (res) { wx.openLocation({ //​使用微信内置地图查看位置。 latitude: Number(that.data.latitude), //要去的纬度-地址 longitude: Number(that.data.longitude), //要去的经度-地址 name: that.data.warehouseName, address: that.data.warehouseName }) } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })