Open canbaozxc opened 6 years ago
问题复现步骤:
1.通过vue指令安装mpvue 2.在src目录下的utils文件夹中新建map目录并存放好用于微信小程序的qqmap-wx-jssdk.min.js 3.回到pages目录在index页面引入腾讯地图组件qqmap-wx-jssdk.min.js,代码如下 var QQMapWX = require('../../utils/map/qqmap-wx-jssdk.js'); var qqmapsdk; 4.在页面生命周期created或者mounted里面添加实例化 // 实例化API核心类 qqmapsdk = new QQMapWX({ key: 'DZBBZ-2XSCW-U6IRS-OINHG-32MZZ-6EFF5' });
5.使用qqmapsdk调用组件各种功能 期望的表现:
[能够使用实例化的腾讯地图组件,进行城市,地址,周边信息查询]
观察到的表现:
出现两个报错 1.thirdScriptError sdk uncaught third Error Cannot assign to read only property 'exports' of object '#' TypeError: Cannot assign to read only property 'exports' of object '#' at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:671:28) at Object._ (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:673:12) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:117:23) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:26:128) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:13:72) at webpack_require (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object.webpackJsonpCallback [as webpackJsonp] (http://127.0.0.1:36311/appservice/static/js/manifest.js:38:26)
去这个文件看一下 .babelrc 加了 一个 transform-es2015-modules-commonjs 支持 commonjs规范 哎呀 哪里大神咯 相互学习撒~
问题复现步骤:
1.通过vue指令安装mpvue 2.在src目录下的utils文件夹中新建map目录并存放好用于微信小程序的qqmap-wx-jssdk.min.js 3.回到pages目录在index页面引入腾讯地图组件qqmap-wx-jssdk.min.js,代码如下 var QQMapWX = require('../../utils/map/qqmap-wx-jssdk.js'); var qqmapsdk; 4.在页面生命周期created或者mounted里面添加实例化 // 实例化API核心类 qqmapsdk = new QQMapWX({ key: 'DZBBZ-2XSCW-U6IRS-OINHG-32MZZ-6EFF5' });
5.使用qqmapsdk调用组件各种功能 期望的表现:
[能够使用实例化的腾讯地图组件,进行城市,地址,周边信息查询]
观察到的表现:
出现两个报错 1.thirdScriptError sdk uncaught third Error Cannot assign to read only property 'exports' of object '#' TypeError: Cannot assign to read only property 'exports' of object '#' at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:671:28) at Object._ (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:673:12) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:117:23) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:26:128) at webpackrequire (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object. (http://127.0.0.1:36311/appservice/static/js/pages/map/main.js:13:72) at webpack_require (http://127.0.0.1:36311/appservice/static/js/manifest.js:71:31) at Object.webpackJsonpCallback [as webpackJsonp] (http://127.0.0.1:36311/appservice/static/js/manifest.js:38:26)