map.vue 845 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <!--product/map/map.wxml-->
  3. <map id="myMap" class="map" :latitude="merchant.lat" :longitude="merchant.lng" :markers="markers" show-location></map>
  4. </template>
  5. <script>
  6. // product/map/map.js
  7. const req = require("../../utils/request.js");
  8. var QQMapWX = require("../../utils/qqmap.js");
  9. export default {
  10. data() {
  11. return {
  12. merchant: {},
  13. markers: []
  14. };
  15. },
  16. components: {},
  17. props: {},
  18. onLoad: function (options) {},
  19. onShow() {
  20. let merchant = req.getStorage("MERCHANT");
  21. // console.log(merchant);
  22. this.setData({
  23. merchant: merchant
  24. });
  25. this.setData({
  26. 'markers[0].latitude': merchant.lat,
  27. 'markers[0].longitude': merchant.lng,
  28. 'markers[0].iconPath': "/static/pages/images/location.png"
  29. });
  30. },
  31. methods: {}
  32. };
  33. </script>
  34. <style>
  35. @import "./map.css";
  36. </style>