When Tencent Map is called asynchronously by vue3.0, he prompts is not defined what to do when packing.

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.
clipboard.png


I didn't configure it, so I used another solution:

in all places where qq appears, replace it with window.qq

.

I tried that both local and build are good under version 3


it doesn't work to try window.qq.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea62c0-1dba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea62c0-1dba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?