track.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. const APP = getApp();
  2. let mapContext; //地图对象
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. mapCenter: { //地图聚焦中心 默认北京
  9. latitude: 39.5395312,
  10. longitude: 116.7265250,
  11. },
  12. markers: [
  13. {
  14. id: 1,
  15. iconPath: "/imgs/marker.png",
  16. latitude: 39.54843965881564,
  17. longitude: 116.77418632902149,
  18. width: 35,
  19. height: 35
  20. },
  21. {
  22. id: 2,
  23. iconPath: "/imgs/marker.png",
  24. latitude: 39.547527631306934,
  25. longitude: 116.77166040587744,
  26. width: 35,
  27. height: 35
  28. },
  29. {
  30. id: 3,
  31. iconPath: "/imgs/marker.png",
  32. latitude: 39.5434256,
  33. longitude: 116.7548242,
  34. width: 35,
  35. height: 35
  36. }, {
  37. id: 4,
  38. iconPath: "/imgs/marker.png",
  39. latitude: 39.5395312,
  40. longitude: 116.7265250,
  41. width: 35,
  42. height: 35
  43. }
  44. , {
  45. id: 5,
  46. iconPath: "/imgs/marker.png",
  47. latitude: 39.5368093,
  48. longitude: 116.7186292,
  49. width: 35,
  50. height: 35
  51. }],
  52. polyline: [{
  53. points: [
  54. {
  55. latitude: 39.54843965881564,
  56. longitude: 116.77418632902149
  57. }, {
  58. latitude: 39.547527631306934,
  59. longitude: 116.77166040587744
  60. }, {
  61. latitude: 39.5434256,
  62. longitude: 116.7548242
  63. }, {
  64. latitude: 39.5395312,
  65. longitude: 116.7265250
  66. },
  67. {
  68. latitude: 39.5368093,
  69. longitude: 116.7186292
  70. }],
  71. width: 5,
  72. arrowLine: true,
  73. color: "#5D88FF"
  74. }],
  75. },
  76. /**
  77. * 生命周期函数--监听页面加载
  78. */
  79. onLoad: function (options) {
  80. // 获取地图对象
  81. mapContext = wx.createMapContext('map');
  82. },
  83. /**
  84. * 生命周期函数--监听页面显示
  85. */
  86. onShow: function () {
  87. },
  88. })