map.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="container">
  3. <!-- <navbar :config="config" backColor="#999999"></navbar> -->
  4. </view>
  5. </template>
  6. <script>
  7. let app = getApp();
  8. export default {
  9. data() {
  10. return {
  11. RefreshMap: false
  12. };
  13. },
  14. onLoad() {
  15. uni.$on('mapJump', (data) => {
  16. this.$openPage(data)
  17. })
  18. uni.$on('onMapNextPage', res => {
  19. this.RefreshMap = false;
  20. });
  21. },
  22. onShow() {
  23. this.openSubNVue()
  24. if (this.RefreshMap) {
  25. uni.$emit('initMap', {
  26. init: true
  27. })
  28. }
  29. this.RefreshMap = true;
  30. },
  31. onUnload() {
  32. uni.$off('initPop')
  33. uni.$off('mapJump')
  34. uni.$off('onMapNextPage')
  35. },
  36. methods: {
  37. openSubNVue() {
  38. const subNVue = uni.getSubNVueById('mapPopup');
  39. subNVue.setStyle({
  40. "top": '0',
  41. 'bottom': 0
  42. // "height": screenHeight - navHeight + 'px'
  43. })
  44. subNVue && subNVue.show()
  45. // this.subNVue && this.subNVue.show('slide-in-left', 300, () => {
  46. // console.log('初始化')
  47. // })
  48. },
  49. onSearch(e) {
  50. uni.$emit('NextMap', e)
  51. },
  52. onSearchKwd(e) {
  53. uni.$emit('NextMapKwd', e)
  54. }
  55. },
  56. onHide() {
  57. setTimeout(() => {
  58. const subNVue = uni.getSubNVueById('mapPopup');
  59. subNVue && subNVue.hide()
  60. }, 100)
  61. }
  62. };
  63. </script>