SOURCE

console 命令行工具 X clear

                    
>
console
const imgLayer = new ol.layer.Tile({
    source: new ol.source.XYZ({
        url: 'https://t6.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=d036788cdefe90183733c3cb68078ead'
    })
})

const map = new ol.Map({
    target: 'map',
    layers: [
        // new ol.layer.Tile({
        //     source: new ol.source.OSM()
        // }),
        imgLayer
    ],
    view: new ol.View({
        center: ol.proj.fromLonLat([116.39123296750768, 39.907180309385694]),
        zoom: 8
    })
});
<div id="map"></div>
html,body {
    margin: 0;
    padding: 0;
    height: 100%;
}

#map {
    height: 100%;
    width: 100%;
}

本项目引用的自定义外部资源