Google Maps API v3 click event not working in Ioni

2019-03-06 02:30发布

I have a google maps implementation with various dropped pins. When clicked they open a information Window with a simple string. This all works well and dandy in the Ionic serve. But does not do anything in the iOS emulator or running in the device. When running on the simulator or device I get no error or see any message associated with the event. Reading up on this issue I did set data-tap-disable="true" on the div we're the map resides. Can't seem to find any other solution. What can I do to fix this?

2条回答
Viruses.
2楼-- · 2019-03-06 03:01

// Fix for Google AutoComplete Places Javascript API on iOS WORK and tested on iphone5/6/7

if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
        setTimeout(function () {
            let container = document.getElementsByClassName('pac-container')[0];
            // Fix for Google AutoComplete Places Javascript API on iOS
            if (container) {
                container.addEventListener('touchend', function (e) {
                    e.stopImmediatePropagation();
                });
            }
        }, 500);
    }
查看更多
来,给爷笑一个
3楼-- · 2019-03-06 03:17

I had the same issue as you, try putting data-tap-disabled="true" on the div that contains the map. I had to take it even a step further and write something to apply data-tap-disabled="true" only when the info-window is showing.

Note I used data-tap-disabled while you're saying you tried data-tap-disable.

查看更多
登录 后发表回答