Skip to content

Commit 4b5beb8

Browse files
committed
init
1 parent 810b00d commit 4b5beb8

11 files changed

+207
-150
lines changed

.babelrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"browsers": ["> 1%", "last 2 versions", "ie >= 10"]
9+
}
10+
}
11+
],
12+
"@vue/cli-plugin-babel/preset"
13+
],
14+
"plugins": ["@babel/plugin-transform-runtime"]
15+
}

.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/lib/
2+
/libs/
3+
/web/
4+
/pack/
5+
/dist/
6+
pages/

.eslintrc.js

+32-7
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,40 @@ module.exports = {
44
node: true,
55
},
66
extends: [
7-
"plugin:vue/essential",
8-
"eslint:recommended",
9-
"plugin:prettier/recommended",
7+
'plugin:vue/essential',
8+
'eslint:recommended',
9+
'plugin:prettier/recommended',
1010
],
1111
parserOptions: {
12-
parser: "@babel/eslint-parser",
12+
parser: '@babel/eslint-parser',
1313
},
1414
rules: {
15-
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
16-
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
15+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
16+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
17+
'global-require': 0,
18+
//强制使用单引号
19+
quotes: ['error', 'single'],
20+
indent: 0,
21+
'no-new': 0,
22+
camelcase: 0,
23+
'padded-blocks': 0,
24+
'no-unused-vars': 0,
25+
'no-trailing-spaces': 0,
26+
'no-mixed-spaces-and-tabs': 0,
27+
'space-before-function-paren': [0, 'always'],
28+
'no-multiple-empty-lines': 0,
1729
},
18-
};
30+
globals: {
31+
__SERVICE_URL__: false,
32+
Vue: false,
33+
Vuex: false,
34+
VueRouter: false,
35+
Fetch: false,
36+
Hub: false,
37+
echarts: false,
38+
axios: false,
39+
Cesium: false,
40+
DC: false,
41+
'%=': false,
42+
},
43+
}

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"eslintIntegration": true,
3+
"singleQuote": true,
4+
"semi": false
5+
}

babel.config.js

-3
This file was deleted.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"lint": "vue-cli-service lint"
99
},
1010
"dependencies": {
11+
"@dvgis/dc-sdk": "^3.4.0",
12+
"@dvgis/dc-sdk-types": "^1.0.0",
1113
"core-js": "^3.8.3",
1214
"vue": "^2.6.14"
1315
},
@@ -17,6 +19,7 @@
1719
"@vue/cli-plugin-babel": "~5.0.0",
1820
"@vue/cli-plugin-eslint": "~5.0.0",
1921
"@vue/cli-service": "~5.0.0",
22+
"copy-webpack-plugin": "^12.0.2",
2023
"eslint": "^7.32.0",
2124
"eslint-config-prettier": "^8.3.0",
2225
"eslint-plugin-prettier": "^4.0.0",

src/App.vue

+28-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
11
<template>
22
<div id="app">
3-
<img alt="Vue logo" src="./assets/logo.png" />
4-
<HelloWorld msg="Welcome to Your Vue.js App" />
3+
<div id="viewer-container" class="viewer-container"></div>
54
</div>
65
</template>
76

87
<script>
9-
import HelloWorld from "./components/HelloWorld.vue";
10-
118
export default {
12-
name: "App",
13-
components: {
14-
HelloWorld,
9+
name: 'App',
10+
components: {},
11+
methods: {
12+
initViewer() {
13+
new DC.Viewer('viewer-container')
14+
},
15+
},
16+
mounted() {
17+
this.$nextTick(() => {
18+
DC.ready().then(this.initViewer)
19+
})
1520
},
16-
};
21+
}
1722
</script>
1823

1924
<style>
25+
* {
26+
padding: 0;
27+
margin: 0;
28+
}
29+
30+
html,
31+
body,
2032
#app {
21-
font-family: Avenir, Helvetica, Arial, sans-serif;
22-
-webkit-font-smoothing: antialiased;
23-
-moz-osx-font-smoothing: grayscale;
24-
text-align: center;
25-
color: #2c3e50;
26-
margin-top: 60px;
33+
width: 100%;
34+
height: 100%;
35+
overflow: hidden;
36+
}
37+
.viewer-container {
38+
width: 100%;
39+
height: 100%;
40+
overflow: hidden;
2741
}
2842
</style>

src/components/HelloWorld.vue

-114
This file was deleted.

src/main.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import Vue from "vue";
2-
import App from "./App.vue";
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
import * as DC from '@dvgis/dc-sdk'
4+
import '@dvgis/dc-sdk/dist/dc.min.css'
5+
Vue.config.productionTip = false
36

4-
Vue.config.productionTip = false;
7+
global.DC = DC
58

69
new Vue({
710
render: (h) => h(App),
8-
}).$mount("#app");
11+
}).$mount('#app')

vue.config.js

+35-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
1-
const { defineConfig } = require("@vue/cli-service");
2-
module.exports = defineConfig({
3-
transpileDependencies: true,
4-
});
1+
'use strict'
2+
const path = require('path')
3+
4+
const CopyWebpackPlugin = require('copy-webpack-plugin')
5+
const dvgisDist = './node_modules/@dvgis'
6+
7+
let resolve = (dir) => {
8+
return path.resolve(__dirname, dir)
9+
}
10+
11+
module.exports = {
12+
publicPath: process.env.NODE_ENV === 'production' ? '/dc-vue' : '/',
13+
productionSourceMap: false,
14+
configureWebpack: {
15+
module: {
16+
unknownContextCritical: false,
17+
},
18+
performance: {
19+
hints: false,
20+
},
21+
},
22+
chainWebpack: (config) => {
23+
config.resolve.extensions.add('.js').add('.cjs').add('.vue').end()
24+
config.plugin('copy').use(CopyWebpackPlugin, [
25+
{
26+
patterns: [
27+
{
28+
from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
29+
to: path.join(__dirname, 'dist', 'libs/dc-sdk/resources'),
30+
},
31+
],
32+
},
33+
])
34+
},
35+
}

0 commit comments

Comments
 (0)