Vue: Cesium configuration memo in Vue project

Author:CSDN @ _乐多_

This article records the process and details related to configuring Cesium in the Vue project.



1. Install Cesium

npm install Cesium

Find Cesium in node_modules and copy the Cesium folder to public.

Insert image description here

2. Configure index.html

Mainly add these two lines,

<link rel="stylesheet" href="./Cesium/Widgets/widgets.css">
<script src="./Cesium/Cesium.js"></script>

The entire index.html is as follows,

<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <title>
    <%= htmlWebpackPlugin.options.title %>
  </title>

  <link rel="stylesheet" href="./Cesium/Widgets/widgets.css">

</head>

<body>
  <noscript>
    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
        Please enable it to continue.</strong>
  </noscript>
  <div id="app"></div>
  <!-- built files will be auto injected -->
  <script src="./Cesium/Cesium.js"></script>
</body>

</html>

Statement:
As an author, I attach great importance to my own works and intellectual property rights. I hereby declare that all my original articles are protected by copyright law and no one may publish them publicly without my authorization.
My articles have been published on some well-known platforms for a fee. I hope that readers can respect intellectual property rights and refrain from infringement. Any act of publishing paid articles on the Internet for free or for a fee (including commercial use) without my authorization will be regarded as infringement of my copyright, and I reserve the right to pursue legal liability.
Thank you readers for your attention and support for my article!

おすすめ

転載: blog.csdn.net/yyyyyyyyyyy_9/article/details/134168626