源码
新建文件夹Exp01,新建一个Demo01.html源码,拷贝build文件夹到Exp01文件夹。
编写网页源码如下:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <!-- Use correct character set. --> 5 <meta charset="utf-8" /> 6 <!-- Tell IE to use the latest, best version. --> 7 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 8 <!-- Make the application on mobile take up the full browser screen and disable user scaling. --> 9 <meta 10 name="viewport" 11 content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" 12 /> 13 <title>Hello World!</title> 14 <script src="../Build/CesiumUnminified/Cesium.js"></script> 15 <style> 16 @import url(../Build/CesiumUnminified/Widgets/widgets.css); 17 html, 18 body, 19 #cesiumContainer { 20 width: 100%; 21 height: 100%; 22 margin: 0; 23 padding: 0; 24 overflow: hidden; 25 } 26 </style> 27 </head> 28 <body> 29 <div id="cesiumContainer"></div> 30 <script> 31 const viewer = new Cesium.Viewer("cesiumContainer",{ 32 geocoder:true, 33 homeButton:true, 34 sceneModePicker:true, 35 baseLayerPicker:true, 36 navigationHelpButton:true, 37 animation:false, 38 timeline:false, 39 fullscreenBUtton:true, 40 }); 41 </script> 42 </body> 43 </html>
发布
以管理员身份运行CMD,在其中输入命令如黄色部分,采样http-server进行网页发布。
D:\CesiumExp\CesiumJS>cnpm install http-server -g
D:\CesiumExp\Exp01>http-server -g http-server version: 14.1.1 http-server settings: Available on: |
复制任意一个网址访问