MikesWei / CesiumVectorTile

Cesium VectorTileImageryProvider支持小数据量的geojson、shape文件 矢量 动态切片,实现贴地
https://mikeswei.github.io/CesiumVectorTile/
Apache License 2.0
418 stars 161 forks source link

和VueCesium一起使用报错 #22

Closed DuShuYuan closed 2 years ago

DuShuYuan commented 2 years ago

在ready函数中加载本地shp文件

onViewerReady ({ Cesium, viewer }) {

            // eslint-disable-next-line no-unused-vars
            var worldLayer = null
            // eslint-disable-next-line no-unused-vars
            var worldProvider = new VectorTileImageryProvider({
                source: 'http://localhost:1379/map/shp/区域_全球国界.shp',
                defaultStyle: {
                    outlineColor: 'rgb(255,0,0)',
                    lineWidth: 1,
                    fill: false,
                    tileCacheSize: 200,
                    showMaker: false,
                    showCenterLabel: true,
                    fontColor: 'rgba(255,0,0,1)',
                    labelOffsetX: -10,
                    labelOffsetY: -5,
                    fontSize: 13,
                    fontFamily: '黑体',
                    centerLabelPropertyName: 'NAME'
                },
                maximumLevel: 20,
                minimumLevel: 1,
                simplify: false
            })
            worldProvider.readyPromise.then(function () {
                worldLayer = viewer.imageryLayers.addImageryProvider(worldProvider)
            })
        }

报错信息: Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'defaultAccessToken') at load (webpack-internal:///./node_modules/vue-cesium/es/components/viewer/src/useViewer.mjs:487:28)

DuShuYuan commented 2 years ago

https://github.com/zouyaoji/vue-cesium/issues/155