Framework7 google maps not loading on second page click

我与影子孤独终老i 提交于 2019-12-12 03:05:43

问题


Hi I have a problem using framework7 at first load the map is loading when I navigate to a different page then click back to the page with the google map the map doesn't load.

if (page.name === 'location') {
         new GMaps({
          div: '#map',
          lat: -12.043333,
          lng: -77.028333
        });

}

回答1:


For Those using framework 7 and encounter this error Id like to post what I did to make it right just investigated that the elements in framework7's pages are cached when navigating to each pages thats why google maps can only appear on first navigation of the page with map the second time you navigate the page is duplicated from which the DOM your targeting is on the cache thats why its not appearing in the second time you navigate to the page with googlemap.

 var mainView = myApp.addView('.view-main', {
   domCache:false,
 });

set the domcache to false; By default its true. You need to make it false to load your map properly.



来源:https://stackoverflow.com/questions/40542519/framework7-google-maps-not-loading-on-second-page-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!