简体   繁体   中英

Framework7 google maps not loading on second page click

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
        });

}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM