在html静态页面中用import导入js文件 前提是js文件是一个模块
<script>
vis3ds = null;
</script>
<script type="module">
import vis3d from "../static/libs/vis3d/vis3d.js"
vis3ds = vis3d;
console.log(vis3d);
</script>
有时可能读不到 是加载时机的问题 笨办法是加定时器 聪明办法还没找到
<script>
setTimeout(() => {
let mapViewer = (window.mapViewer = new vis3ds.MapViewer(
"mapContainer",
mapConfig
));
window.viewer = mapViewer._viewer;
}, 2000);
</script>