1

我一直试图让谷歌地图在我的煎茶触摸页面上工作,但它就是行不通。我找到了很多关于这个问题的主题,但我似乎无法在我的代码中找到问题。基本上目前我正在尝试使用谷歌地图在我当前的位置上放置一个标记。稍后我将尝试显示基于给定地址的路线。但是当我打开页面时,我只看到地图的界面元素。它在我的 chrome 元素检查器中一直在说以下内容:

Uncaught RangeError: Maximum call stack size exceeded
ze
F.get
F.get
(anonymous function)
F.transform_changed
ag
ag
F.set
Rs.(anonymous function).ta
F.aa
Qh.(anonymous function).l
(anonymous function)
O.trigger
F.aa
Qh.(anonymous function).l
(anonymous function)
O.trigger
F.aa
Qh.(anonymous function).l
(anonymous function)
O.trigger

我刚刚注意到我还在元素检查器中收到以下消息:

Resource interpreted as Font but transferred with MIME type font/woff: "http://themes.googleusercontent.com/static/fonts/roboto/v9/Hgo13k-tfSpn0qi1SFdUfT8E0i7KZn-EPnyo3HZu7kw.woff".
Resource interpreted as Font but transferred with MIME type font/woff: "http://themes.googleusercontent.com/static/fonts/roboto/v9/2UX7WLTfW3W8TclTUvlFyQ.woff".
Resource interpreted as Font but transferred with MIME type font/woff: "http://themes.googleusercontent.com/static/fonts/roboto/v9/RxZJdnzeo3R5zSexge8UUT8E0i7KZn-EPnyo3HZu7kw.woff".

我认为的代码如下:

Ext.define('Sencha.view.Tournaments', {

    extend: 'Ext.Container',
    xtype: 'tournamentPage',
    config: {
        title: 'maps',
        layout: 'fit'
    },

    initialize : function() {
        var lat, lng;
        var geoLocationOptions = {
            maximumAge: 3000, 
            timeout: 5000, 
            enableHighAccuracy: true
        };
        navigator.geolocation.getCurrentPosition(geoLocationSuccess,geoLocationError,geoLocationOptions);

        function geoLocationSuccess(position) {
            lat = position.coords.latitude;
            lng = position.coords.longitude;
        }

        function geoLocationError() {
            Ext.Msg.alert('Error','Error while getting geolocation');
        }
        var position = new google.maps.LatLng(lat,lng);
        map = this.add({
            xtype: 'map',
            getLocation: true,
            autoLoad: true,
            mapOptions: {
                zoom: 15,
                center: position,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                navigationControl: true,
                zoomControl: true,
                mapTypeControl: true,
                scrollwheel: true,
                scaleControl: true,
                zoomControlOptions: {
                    style: google.maps.ZoomControlStyle.LARGE
                }
            }
        });

        marker = new google.maps.Marker({
            id: 'geoLocMarker',
            position: position,
            map: map.getMap(),
            visible: true
        });
    }



})

我希望我不会问愚蠢的问题,我正在努力学习!我已经做了一段时间了,但它似乎不起作用!提前致谢。

4

0 回答 0