想做的效果就是卫星固定,地球再转。
原生:
viewer.dataSources.add(Cesium.CzmlDataSource.load('../static/Cesium/Assets/czml/simple.czml')).then(function (dataSource) {
viewer.trackedEntity = dataSource.entities.getById('Satellite/ISS')
})
Vue:因为作用域的问题需要在加载前定义一个变量接this(个人愚见)
let _this = this
this.viewer.dataSources.removeAll() // 删除之前所有引用的数据源
this.viewer.dataSources.add(Cesium.CzmlDataSource.load('../static/Cesium/Assets/czml/simple.czml')).then(function (dataSource) {
_this.viewer.trackedEntity = dataSource.entities.getById('Satellite/ISS')
})