我使用了url:http://map-icons.com/中的map-icons但是map-icons.js,map-icons.css和'fonts'文件,但我无法成功。收到的错误是
未捕获的ReferenceError:google未在map-icons.js:42
中定义
地图icons.js
var inherits = function(childCtor, parentCtor) {
/** @constructor */
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
childCtor.prototype.constructor = childCtor;
};
function Marker(options){
google.maps.Marker.apply(this, arguments);if (options.map_icon_label) {
this.MarkerLabel = new MarkerLabel({
map: this.map,
marker: this,
text: options.map_icon_label
});
this.MarkerLabel.bindTo('position', this, 'position');
}
}
// Apply the inheritance
inherits(Marker, google.maps.Marker);
map-icons.js第42行是“继承(Marker,google.maps.Marker); ” 我没有任何改变地放置它。我该怎么办?我应该在map-icons.js文件中更改什么?
答案 0 :(得分:2)
确保您包含谷歌地图之前包含map-icons.js
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>
<script type="text/javascript" src="path-to-map-icons.js"></script>