cesium安装

cesium安装,第1张

1、安装cesium

npm install cesium 

2、在vue.config.js加入如下

const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers'
modele.exports={
configureWebpack:{
resolve: {
    alias: {
    '@': resolve('src'),
    'cesium': path.resolve(__dirname, cesiumSource)
  }
},
plugins:[
    new CopyWebpackPlugin([{ from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' }]),
    new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Assets'), to: 'Assets' }]),
    new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' }]),
    new CopyWebpackPlugin([{ from: path.join(cesiumSource,      'ThirdParty/Workers'), to: 'ThirdParty/Workers' }]),
    new webpack.DefinePlugin({
      //此处路径要注意!!根据自己的资源路径
      CESIUM_BASE_URL: JSON.stringify('../')
    })
],
amd:{
    toUrlUndefined:true
},
module: {
    unknownContextCritical: false,
    unknownContextRegExp:/\/cesium\/cesium\/Source\/Core\/buildModuleUrl\.js/,
}
}
}

3、引入

var Cesium = require('cesium/Cesium');
var widgets= require('cesium/Widgets/widgets.css');
Vue.prototype.Cesium = Cesium;
Vue.prototype.widgets = widgets

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/939986.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-17
下一篇 2022-05-17

发表评论

登录后才能评论

评论列表(0条)

保存