Closed IronRookie closed 2 years ago
const BMapGL = (window as any).BMapGL const map = new BMapGL.Map('map_container')
如代码所示,子应用是这么用的,但是接入主应用以后,会报错,Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Map'),提示window上并没有BMapGL,这个时候应该怎么解决了
async fetch (url, ...args) { if (['baidu.com'].some(item => url.includes(item))) { return { async text () { return '' } } } return window.fetch(url, ...args) }
之前为了解决跨域报错,设置了fetch函数
百度地图问题解决方案:
如代码所示,子应用是这么用的,但是接入主应用以后,会报错,Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Map'),提示window上并没有BMapGL,这个时候应该怎么解决了
之前为了解决跨域报错,设置了fetch函数