this is how it was introduced
methods: {
loadMap() {
return new Promise(function(resolve, reject) {
window.init = function() {
resolve(qq);
};
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://map.qq.com/api/js?v=2.exp&callback=init";
script.onerror = reject;
document.head.appendChild(script);
});
},
init() {
var mapLatlng = new qq.maps.LatLng(39.916527, 116.397128);
var mapOptions = {
center: mapLatlng,
zoom: 9
};
var mapId = document.getElementById(this.idName);
var mapQQ = new qq.maps.Map(mapId, mapOptions);
}
},
created() {
var self = this;
this.loadMap().then(function() {
self.init();
});
}
there is no problem in introducing this into use, but it will prompt "qq" is not defined
when packaging, there is a solution like this on the
website, but vue cli 3.0 only has vue.config.js file configuration. Not really.