{"id":152784,"date":"2020-09-08T01:44:44","date_gmt":"2020-09-07T17:44:44","guid":{"rendered":"http:\/\/4563.org\/?p=152784"},"modified":"2020-09-08T01:44:44","modified_gmt":"2020-09-07T17:44:44","slug":"%e6%90%ad%e5%bb%ba%e4%ba%86%e4%b8%80%e4%b8%aa%e7%ae%80%e5%8d%95%e7%9a%84-vue-cesium-%e6%9e%b6%e5%ad%90%ef%bc%8c%e5%8f%af%e4%bb%a5%e7%9b%b4%e6%8e%a5%e6%8b%89%e5%8f%96%e9%a1%b9%e7%9b%ae%ef%bc%8c","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=152784","title":{"rendered":"\u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 Vue Cesium \u67b6\u5b50\uff0c\u53ef\u4ee5\u76f4\u63a5\u62c9\u53d6\u9879\u76ee\uff0c\u81ea\u5df1\u6269\u5c55\u3002\u9a97\u4e2a star"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 Vue Cesium \u67b6\u5b50\uff0c\u53ef\u4ee5\u76f4\u63a5\u62c9\u53d6\u9879\u76ee\uff0c\u81ea\u5df1\u6269\u5c55\u3002\u9a97\u4e2a star               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : w3cfed <\/span>  <span><i><\/i> 21<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 Vue Cesium \u67b6\u5b50\uff0c\u53ef\u4ee5\u76f4\u63a5\u62c9\u53d6\u9879\u76ee\uff0c\u81ea\u5df1\u6269\u5c55\u3002<\/p>\n<p>https:\/\/github.com\/martinageradams\/vue-cesium-example<\/p>\n<h1>vue-cesium-example<\/h1>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200908_5f5760aad6317.gif\" alt=\"\u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 Vue Cesium \u67b6\u5b50\uff0c\u53ef\u4ee5\u76f4\u63a5\u62c9\u53d6\u9879\u76ee\uff0c\u81ea\u5df1\u6269\u5c55\u3002\u9a97\u4e2a star\" \/><\/p>\n<h2>Project setup<\/h2>\n<h3>use<\/h3>\n<pre><code>git clone [email&#160;protected]:martinageradams\/vue-cesium-example.git <\/code><\/pre>\n<pre><code>yarn install <\/code><\/pre>\n<h3>Compiles and hot-reloads for development<\/h3>\n<pre><code>yarn serve <\/code><\/pre>\n<h3>Compiles and minifies for production<\/h3>\n<pre><code>yarn build <\/code><\/pre>\n<h3>Run your unit tests<\/h3>\n<pre><code>yarn test:unit <\/code><\/pre>\n<h3>Lints and fixes files<\/h3>\n<pre><code>yarn lint <\/code><\/pre>\n<h3>vue.config.js<\/h3>\n<pre><code>\/\/ vue.config.js const CopyWebpackPlugin = require(\"copy-webpack-plugin\"); const webpack = require(\"webpack\");  module.exports = {   configureWebpack: {     plugins: [       \/\/ Copy Cesium Assets, Widgets, and Workers to a static directory       new CopyWebpackPlugin({         patterns: [           { from: \"node_modules\/cesium\/Build\/Cesium\/Workers\", to: \"Workers\" },           {             from: \"node_modules\/cesium\/Build\/Cesium\/ThirdParty\",             to: \"ThirdParty\"           },           { from: \"node_modules\/cesium\/Build\/Cesium\/Assets\", to: \"Assets\" },           { from: \"node_modules\/cesium\/Build\/Cesium\/Widgets\", to: \"Widgets\" }         ]       }),       new webpack.DefinePlugin({         \/\/ Define relative base path in cesium for loading assets         CESIUM_BASE_URL: JSON.stringify(\"\")       })     ],     module: {       \/\/ Removes these errors: \"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted\"       \/\/ https:\/\/github.com\/AnalyticalGraphicsInc\/cesium-webpack-example\/issues\/6       unknownContextCritical: false,       unknownContextRegExp: \/\/cesium\/cesium\/Source\/Core\/buildModuleUrl.js\/     }   } }; <\/code><\/pre>\n<h3>Map.vue<\/h3>\n<pre><code>&lt;template&gt;   &lt;div id=\"cesiumContainer\"&gt;&lt;\/div&gt; &lt;\/template&gt;  &lt;script&gt; import \"cesium\/Build\/Cesium\/Widgets\/widgets.css\"; import * as Cesium from \"cesium\";  export default {   name: \"Map\",   mounted() {     this.init();   },   methods: {     init() {       let viewer = new Cesium.Viewer(\"cesiumContainer\");        let imageryLayers = viewer.imageryLayers;        let googleMap = new Cesium.UrlTemplateImageryProvider({         url: \"http:\/\/www.google.com\/maps\/[email&#160;protected]&amp;x={x}&amp;y={y}&amp;z={z}\"       });        imageryLayers.addImageryProvider(googleMap);        \/\/ fly       viewer.camera.flyTo({         destination: Cesium.Cartesian3.fromDegrees(           114.296063,           30.55245,           20000000         ),         orientation: {           heading: Cesium.Math.toRadians(0),           pitch: Cesium.Math.toRadians(-90),           roll: 0.0         },         duration: 10 \/\/ fly time 10s       });     }   } }; &lt;\/script&gt;  &lt;style lang=\"scss\" scoped&gt; #cesiumContainer {   width: 100vw;   height: 100vh;   margin: 0;   padding: 0;   overflow: hidden; } &lt;\/style&gt; <\/code><\/pre>\n<h3>Customize configuration<\/h3>\n<p>See Configuration Reference.<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3059039\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : RYAN0UP <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             amazing\uff0c\u5df2 star \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3059040\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : w3cfed <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @RYAN0UP \u611f\u8c22\uff0c\u4e3b\u8981\u662f Webpack \u914d\u7f6e\u6bd4\u8f83\u5751\u3002\u6211\u627e\u4e86\u534a\u5929\u624d\u914d\u7f6e\u597d\u3002\u4f46\u662f\u7a81\u7136\u53d1\u73b0\u4e86\u4e00\u4e2a npm \u4e13\u95e8\u89e3\u51b3\u8fd9\u4e2a\u914d\u7f6e\u95ee\u9898\u3002\u54c8\u54c8\u54c8\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u642d\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 Vue Cesi&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/152784"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=152784"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/152784\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=152784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=152784"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=152784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}