├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── App.vue
├── assets
│ └── logo.png
├── components
│ └── cesiumContainer.vue
├── main.js
├── router.js
└── store.js
└── vue.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw*
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cesium-vue(基于vuecli3.x)
2 |
3 | > 该库已经存档并停止维护 推介使用最新的库vuecli4.x+ [https://github.com/ShareQiu1994/cesium-vue](https://github.com/ShareQiu1994/cesium-vue)
4 |
5 | > 一个整合了Cesium的VueCli3.x的脚手架工具
6 |
7 | 1.项目为VueCli+Cesium的纯净版,除了VueCli自带的模块和Cesium模块,没有引入其他第三方模块。
8 |
9 | 2.根据您的项目需要,可以配置自己需要的模块,如Ui模块(ElementUi,museUi)等。
10 |
11 | 3.建议开发者将写好的Cesium功能封装成一个独立的模块,而不是将cesium的属性赋值给Vue的data对象中(会造成一些性能问题)。
12 |
13 | ## Build Setup
14 |
15 | ``` bash
16 | # 安装依赖
17 | npm install
18 |
19 | # 运行开发环境
20 | npm run serve
21 |
22 | # 编译
23 | npm run build
24 |
25 | # 打开浏览器查看运行结果
26 | localhost:8080
27 | ```
28 |
29 | 邮箱:421419567@qq.com 请右上角Star 万分感激!(^_^)
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cesium-vue2beta",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "cesium": "^1.51.0",
11 | "vue": "^2.5.17",
12 | "vue-router": "^3.0.1",
13 | "vuex": "^3.0.1"
14 | },
15 | "devDependencies": {
16 | "@vue/cli-plugin-babel": "^3.0.4",
17 | "@vue/cli-service": "^3.0.4",
18 | "strip-pragma-loader": "^1.0.0",
19 | "vue-template-compiler": "^2.5.17"
20 | },
21 | "postcss": {
22 | "plugins": {
23 | "autoprefixer": {}
24 | }
25 | },
26 | "browserslist": [
27 | "> 1%",
28 | "last 2 versions",
29 | "not ie <= 8"
30 | ]
31 | }
32 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShareQiu1994/cesium-vue-cli3/a196de38f810de3fcaa78414c351b74534b062cd/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | cesium-vue2
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
22 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShareQiu1994/cesium-vue-cli3/a196de38f810de3fcaa78414c351b74534b062cd/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/cesiumContainer.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
21 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 |
6 | Vue.config.productionTip = false
7 |
8 | new Vue({
9 | router,
10 | store,
11 | render: h => h(App)
12 | }).$mount('#app')
13 |
--------------------------------------------------------------------------------
/src/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import cesiumContainer from './components/cesiumContainer.vue'
4 |
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | base: process.env.BASE_URL,
9 | routes: [
10 | {
11 | path: '/',
12 | name: 'cesiumContainer',
13 | component: cesiumContainer
14 | }
15 | ]
16 | })
17 |
--------------------------------------------------------------------------------
/src/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 |
9 | },
10 | mutations: {
11 |
12 | },
13 | actions: {
14 |
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack')
2 | const path = require('path')
3 | const CopyWebpackPlugin = require('copy-webpack-plugin')
4 | const cesiumSource = 'node_modules/cesium/Source';
5 | const cesiumWorkers = '../Build/Cesium/Workers';
6 |
7 | module.exports = {
8 | publicPath:'./',
9 | assetsDir:'./static',
10 | productionSourceMap:false,
11 | devServer:{
12 | open: true,
13 | },
14 | chainWebpack: config => {
15 | config
16 | .node.set('fs', 'empty').end()
17 | .resolve.alias.set('cesium', path.resolve(__dirname, cesiumSource)).end().end()
18 | .amd({
19 | toUrlUndefined: true
20 | })
21 | .module
22 | .set('unknownContextCritical', false)
23 | .rule()
24 | .include
25 | .add(path.resolve(__dirname, cesiumSource))
26 | .end()
27 | .post()
28 | .pre()
29 | .test(/\.js$/)
30 | .use('strip')
31 | .loader('strip-pragma-loader')
32 | .options({
33 | pragmas: {
34 | debug: false
35 | }
36 | })
37 | .end()
38 | .end()
39 | },
40 | configureWebpack: config => {
41 | let plugins = [];
42 | if (process.env.NODE_ENV === 'production') {
43 | plugins = [
44 | new webpack.DefinePlugin({
45 | 'CESIUM_BASE_URL': JSON.stringify('static')
46 | }),
47 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, cesiumWorkers), to: 'static/Workers' } ]),
48 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, 'Assets'), to: 'static/Assets' } ]),
49 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, 'Widgets'), to: 'static/Widgets' } ]),
50 | ]
51 | } else {
52 | plugins = [
53 | new webpack.DefinePlugin({
54 | 'CESIUM_BASE_URL': JSON.stringify('')
55 | }),
56 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' } ]),
57 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, 'Assets'), to: 'Assets' } ]),
58 | new CopyWebpackPlugin([ { from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' } ]),
59 | ]
60 | }
61 | return {
62 | plugins:plugins
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------