emacroh5lib 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +61 -0
- package/README.md +6 -0
- package/babel.config.js +5 -0
- package/cypress.json +3 -0
- package/jest.config.js +3 -0
- package/package.json +94 -0
- package/postcss.config.js +5 -0
- package/public/favicon.ico +0 -0
- package/public/img/icons/android-chrome-192x192.png +0 -0
- package/public/img/icons/android-chrome-512x512.png +0 -0
- package/public/img/icons/android-chrome-maskable-192x192.png +0 -0
- package/public/img/icons/android-chrome-maskable-512x512.png +0 -0
- package/public/img/icons/apple-touch-icon-120x120.png +0 -0
- package/public/img/icons/apple-touch-icon-152x152.png +0 -0
- package/public/img/icons/apple-touch-icon-180x180.png +0 -0
- package/public/img/icons/apple-touch-icon-60x60.png +0 -0
- package/public/img/icons/apple-touch-icon-76x76.png +0 -0
- package/public/img/icons/apple-touch-icon.png +0 -0
- package/public/img/icons/favicon-16x16.png +0 -0
- package/public/img/icons/favicon-32x32.png +0 -0
- package/public/img/icons/msapplication-icon-144x144.png +0 -0
- package/public/img/icons/mstile-150x150.png +0 -0
- package/public/img/icons/safari-pinned-tab.svg +3 -0
- package/public/index.html +56 -0
- package/public/robots.txt +2 -0
- package/src/App.vue +19 -0
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +117 -0
- package/src/index.ts +21 -0
- package/src/main.ts +19 -0
- package/src/registerServiceWorker.ts +32 -0
- package/src/router/index.ts +29 -0
- package/src/shims-tsx.d.ts +11 -0
- package/src/shims-vue.d.ts +7 -0
- package/src/store/index.ts +17 -0
- package/src/utilities/File.ts +22 -0
- package/src/views/AboutView.vue +5 -0
- package/src/views/HomeView.vue +32 -0
- package/tests/e2e/.eslintrc.js +12 -0
- package/tests/e2e/plugins/index.js +25 -0
- package/tests/e2e/specs/test.js +8 -0
- package/tests/e2e/support/commands.js +25 -0
- package/tests/e2e/support/index.js +20 -0
- package/tests/unit/example.spec.ts +28 -0
- package/tsconfig.json +59 -0
- package/typings.d.ts +12 -0
- package/webpack.config.js +76 -0
package/.eslintrc.js
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module.exports = {
|
2
|
+
root: true,
|
3
|
+
env: {
|
4
|
+
node: true
|
5
|
+
},
|
6
|
+
extends: [
|
7
|
+
'plugin:vue/essential',
|
8
|
+
'@vue/standard',
|
9
|
+
'@vue/typescript/recommended'
|
10
|
+
],
|
11
|
+
parserOptions: {
|
12
|
+
ecmaVersion: 2020
|
13
|
+
},
|
14
|
+
rules: {
|
15
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
16
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
17
|
+
'quotes': 'off',
|
18
|
+
'semi': 'off',
|
19
|
+
'comma-dangle': 'off',
|
20
|
+
'@typescript-eslint/no-var-requires': 0,
|
21
|
+
"space-before-function-paren": 0,
|
22
|
+
'@typescript-eslint/no-empty-function': 0,
|
23
|
+
"padded-blocks": 0,
|
24
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
25
|
+
"@typescript-eslint/no-explicit-any": ["off"],
|
26
|
+
'no-multiple-empty-lines': 0,
|
27
|
+
// 关闭驼峰命名规则
|
28
|
+
'vue/multi-word-component-names': 0,
|
29
|
+
'@typescript-eslint/no-this-alias': ["off"],
|
30
|
+
'lines-between-class-members': ["off"],
|
31
|
+
'indent': ['off', 2],
|
32
|
+
'camelcase': 'off',
|
33
|
+
'spaced-comment': 'off',
|
34
|
+
'no-empty': 'off',
|
35
|
+
'key-spacing': 'off',
|
36
|
+
'prefer-const': 'off',
|
37
|
+
'comma-spacing': 'off',
|
38
|
+
'curly': 'off',
|
39
|
+
'new-cap': 'off',
|
40
|
+
'no-trailing-spaces': 'off',
|
41
|
+
'eol-last': 'off',
|
42
|
+
'eqeqeq': 'off',
|
43
|
+
'brace-style': 'off',
|
44
|
+
'no-multi-spaces': 'off',
|
45
|
+
'yoda': 'off',
|
46
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
47
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
48
|
+
'no-lone-blocks': 'off'
|
49
|
+
},
|
50
|
+
overrides: [
|
51
|
+
{
|
52
|
+
files: [
|
53
|
+
'**/__tests__/*.{j,t}s?(x)',
|
54
|
+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
|
55
|
+
],
|
56
|
+
env: {
|
57
|
+
jest: true
|
58
|
+
}
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}
|
package/README.md
ADDED
package/babel.config.js
ADDED
package/cypress.json
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
{
|
2
|
+
"name": "emacroh5lib",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "EMacro前端组件库",
|
5
|
+
"main": "./dist/emacroh5lib.min.js",
|
6
|
+
"types": "./dist/types/index.d.ts",
|
7
|
+
"scripts": {
|
8
|
+
"build": "webpack --mode=production --node-env=production",
|
9
|
+
"build:dev": "webpack --mode=development",
|
10
|
+
"build:prod": "webpack --mode=production --node-env=production",
|
11
|
+
"test:unit": "vue-cli-service test:unit",
|
12
|
+
"test:e2e": "vue-cli-service test:e2e",
|
13
|
+
"watch": "webpack --watch",
|
14
|
+
"serve": "webpack serve",
|
15
|
+
"dev": "webpack serve",
|
16
|
+
"commit": "cz",
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
18
|
+
},
|
19
|
+
"keywords": [
|
20
|
+
"EMacro"
|
21
|
+
],
|
22
|
+
"author": "wing99.cn",
|
23
|
+
"license": "MIT",
|
24
|
+
"devDependencies": {
|
25
|
+
"@nuxtjs/composition-api": "^0.32.0",
|
26
|
+
"@types/echarts": "^4.9.14",
|
27
|
+
"@types/jest": "^27.4.1",
|
28
|
+
"@types/jquery": "^3.5.14",
|
29
|
+
"@types/mocha": "^9.1.1",
|
30
|
+
"@types/three": "^0.139.0",
|
31
|
+
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
32
|
+
"@typescript-eslint/parser": "^5.20.0",
|
33
|
+
"@vue/cli-plugin-babel": "^5.0.4",
|
34
|
+
"@vue/cli-plugin-e2e-cypress": "^5.0.4",
|
35
|
+
"@vue/cli-plugin-pwa": "^5.0.4",
|
36
|
+
"@vue/cli-plugin-router": "^5.0.4",
|
37
|
+
"@vue/cli-plugin-unit-jest": "^5.0.4",
|
38
|
+
"@vue/cli-plugin-vuex": "~5.0.0",
|
39
|
+
"@vue/cli-service": "~5.0.0",
|
40
|
+
"@vue/composition-api": "^1.4.9",
|
41
|
+
"@vue/eslint-config-standard": "^6.1.0",
|
42
|
+
"@vue/eslint-config-typescript": "^8.0.0",
|
43
|
+
"@vue/test-utils": "^1.1.3",
|
44
|
+
"@vue/vue2-jest": "^27.0.0",
|
45
|
+
"@webpack-cli/generators": "^2.4.2",
|
46
|
+
"autoprefixer": "^10.4.5",
|
47
|
+
"babel-jest": "^27.5.1",
|
48
|
+
"commitizen": "^4.2.4",
|
49
|
+
"css-loader": "^6.7.1",
|
50
|
+
"cypress": "^9.5.4",
|
51
|
+
"eslint": "^7.32.0",
|
52
|
+
"eslint-plugin-import": "^2.26.0",
|
53
|
+
"eslint-plugin-node": "^11.1.0",
|
54
|
+
"eslint-plugin-promise": "^5.2.0",
|
55
|
+
"eslint-plugin-vue": "^7.0.0",
|
56
|
+
"html-webpack-plugin": "^5.5.0",
|
57
|
+
"jest": "^27.0.5",
|
58
|
+
"less": "^4.1.2",
|
59
|
+
"less-loader": "^10.2.0",
|
60
|
+
"mini-css-extract-plugin": "^2.6.0",
|
61
|
+
"postcss": "^8.4.12",
|
62
|
+
"postcss-loader": "^6.2.1",
|
63
|
+
"prettier": "^2.6.2",
|
64
|
+
"style-loader": "^3.3.1",
|
65
|
+
"ts-jest": "^27.1.4",
|
66
|
+
"ts-loader": "^9.2.8",
|
67
|
+
"typescript": "^4.6.3",
|
68
|
+
"vue-template-compiler": "^2.6.14",
|
69
|
+
"webpack": "^5.72.0",
|
70
|
+
"webpack-cli": "^4.9.2",
|
71
|
+
"webpack-dev-server": "^4.8.1"
|
72
|
+
},
|
73
|
+
"dependencies": {
|
74
|
+
"@tweenjs/tween.js": "^18.6.4",
|
75
|
+
"@types/js-cookie": "^3.0.1",
|
76
|
+
"@vue/cli-plugin-typescript": "^5.0.4",
|
77
|
+
"axios": "^0.26.1",
|
78
|
+
"core-js": "^3.22.2",
|
79
|
+
"echarts": "^5.3.2",
|
80
|
+
"echarts-gl": "^2.0.9",
|
81
|
+
"element-ui": "^2.15.8",
|
82
|
+
"jquery": "^3.6.0",
|
83
|
+
"js-cookie": "^3.0.1",
|
84
|
+
"register-service-worker": "^1.7.2",
|
85
|
+
"three": "^0.139.2",
|
86
|
+
"typings": "^2.1.1",
|
87
|
+
"vue": "^2.6.14",
|
88
|
+
"vue-class-component": "^7.2.3",
|
89
|
+
"vue-echarts": "^6.0.2",
|
90
|
+
"vue-property-decorator": "^9.1.2",
|
91
|
+
"vue-router": "^3.5.1",
|
92
|
+
"vuex": "^3.6.2"
|
93
|
+
}
|
94
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="">
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<link rel="icon" href="data:image/ico;base64,aWNv">
|
7
|
+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
10
|
+
<meta name="format-detection" content="telephone=no" />
|
11
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
12
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
13
|
+
<link rel="apple-touch-icon-precomposed" href="iphone_milanoo.png" />
|
14
|
+
<meta name="apple-touch-fullscreen" content="yes">
|
15
|
+
<link rel="dns-prefetch" href="//mc.meituan.net">
|
16
|
+
<link rel="dns-prefetch" href="//p1.meituan.net">
|
17
|
+
<title><%= webpackConfig.name %></title>
|
18
|
+
|
19
|
+
<style>
|
20
|
+
* {
|
21
|
+
margin: 0;
|
22
|
+
padding: 0;
|
23
|
+
}
|
24
|
+
|
25
|
+
html,
|
26
|
+
body {
|
27
|
+
margin: 0;
|
28
|
+
padding: 0;
|
29
|
+
font-size: 12px;
|
30
|
+
width: 100%;
|
31
|
+
height: 100%;
|
32
|
+
font-family: 'Poppins', sans-serif;
|
33
|
+
background: transparent;
|
34
|
+
overflow: hidden;
|
35
|
+
}
|
36
|
+
|
37
|
+
#app {
|
38
|
+
margin: 0;
|
39
|
+
padding: 0;
|
40
|
+
height: 100%;
|
41
|
+
width: 100%;
|
42
|
+
}
|
43
|
+
</style>
|
44
|
+
|
45
|
+
</head>
|
46
|
+
|
47
|
+
<body>
|
48
|
+
<noscript>
|
49
|
+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
50
|
+
Please enable it to continue.</strong>
|
51
|
+
</noscript>
|
52
|
+
<div id="app"></div>
|
53
|
+
<!-- built files will be auto injected -->
|
54
|
+
</body>
|
55
|
+
|
56
|
+
</html>
|
package/src/App.vue
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<template>
|
2
|
+
<div id="app">
|
3
|
+
<router-view />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<style lang="less">
|
8
|
+
#app {
|
9
|
+
width: 100%;
|
10
|
+
height: 100%;
|
11
|
+
padding: 0;
|
12
|
+
margin: 0;
|
13
|
+
font-family: Avenir, Helvetica, Arial, sans-serif;
|
14
|
+
-webkit-font-smoothing: antialiased;
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
16
|
+
text-align: center;
|
17
|
+
color: #2c3e50;
|
18
|
+
}
|
19
|
+
</style>
|
Binary file
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="hello">
|
3
|
+
<h1>{{ msg }}</h1>
|
4
|
+
<p>
|
5
|
+
For a guide and recipes on how to configure / customize this project,<br />
|
6
|
+
check out the
|
7
|
+
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
8
|
+
</p>
|
9
|
+
<h3>Installed CLI Plugins</h3>
|
10
|
+
<ul>
|
11
|
+
<li>
|
12
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank"
|
13
|
+
rel="noopener">babel</a>
|
14
|
+
</li>
|
15
|
+
<li>
|
16
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa" target="_blank"
|
17
|
+
rel="noopener">pwa</a>
|
18
|
+
</li>
|
19
|
+
<li>
|
20
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank"
|
21
|
+
rel="noopener">router</a>
|
22
|
+
</li>
|
23
|
+
<li>
|
24
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank"
|
25
|
+
rel="noopener">vuex</a>
|
26
|
+
</li>
|
27
|
+
<li>
|
28
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank"
|
29
|
+
rel="noopener">eslint</a>
|
30
|
+
</li>
|
31
|
+
<li>
|
32
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest" target="_blank"
|
33
|
+
rel="noopener">unit-jest</a>
|
34
|
+
</li>
|
35
|
+
<li>
|
36
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-cypress" target="_blank"
|
37
|
+
rel="noopener">e2e-cypress</a>
|
38
|
+
</li>
|
39
|
+
<li>
|
40
|
+
<a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank"
|
41
|
+
rel="noopener">typescript</a>
|
42
|
+
</li>
|
43
|
+
</ul>
|
44
|
+
<h3>Essential Links</h3>
|
45
|
+
<ul>
|
46
|
+
<li>
|
47
|
+
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
|
48
|
+
</li>
|
49
|
+
<li>
|
50
|
+
<a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a>
|
51
|
+
</li>
|
52
|
+
<li>
|
53
|
+
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a>
|
54
|
+
</li>
|
55
|
+
<li>
|
56
|
+
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a>
|
57
|
+
</li>
|
58
|
+
<li>
|
59
|
+
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
|
60
|
+
</li>
|
61
|
+
</ul>
|
62
|
+
<h3>Ecosystem</h3>
|
63
|
+
<ul>
|
64
|
+
<li>
|
65
|
+
<a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a>
|
66
|
+
</li>
|
67
|
+
<li>
|
68
|
+
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
|
69
|
+
</li>
|
70
|
+
<li>
|
71
|
+
<a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a>
|
72
|
+
</li>
|
73
|
+
<li>
|
74
|
+
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a>
|
75
|
+
</li>
|
76
|
+
<li>
|
77
|
+
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a>
|
78
|
+
</li>
|
79
|
+
</ul>
|
80
|
+
</div>
|
81
|
+
</template>
|
82
|
+
|
83
|
+
<script lang="ts">
|
84
|
+
import { Component, Prop, Vue } from "vue-property-decorator";
|
85
|
+
|
86
|
+
@Component
|
87
|
+
export default class HelloWorld extends Vue {
|
88
|
+
@Prop() private msg!: string;
|
89
|
+
|
90
|
+
public test():void{
|
91
|
+
|
92
|
+
console.log(this.msg);
|
93
|
+
|
94
|
+
}
|
95
|
+
}
|
96
|
+
</script>
|
97
|
+
|
98
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
99
|
+
<style scoped lang="less">
|
100
|
+
h3 {
|
101
|
+
margin: 40px 0 0;
|
102
|
+
}
|
103
|
+
|
104
|
+
ul {
|
105
|
+
list-style-type: none;
|
106
|
+
padding: 0;
|
107
|
+
}
|
108
|
+
|
109
|
+
li {
|
110
|
+
display: inline-block;
|
111
|
+
margin: 0 10px;
|
112
|
+
}
|
113
|
+
|
114
|
+
a {
|
115
|
+
color: #42b983;
|
116
|
+
}
|
117
|
+
</style>
|
package/src/index.ts
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class Test {
|
4
|
+
|
5
|
+
public static print(info: string): void {
|
6
|
+
console.log(info);
|
7
|
+
|
8
|
+
console.log('测试npm');
|
9
|
+
|
10
|
+
const arr = [1, 2]
|
11
|
+
console.log(arr[5]);
|
12
|
+
|
13
|
+
console.log('测试npm22');
|
14
|
+
console.log('测试npm33333');
|
15
|
+
|
16
|
+
}
|
17
|
+
|
18
|
+
}
|
19
|
+
|
20
|
+
export default Test;
|
21
|
+
export { }
|
package/src/main.ts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
import Vue from 'vue'
|
2
|
+
import App from './App.vue'
|
3
|
+
import './registerServiceWorker'
|
4
|
+
import router from './router'
|
5
|
+
import store from './store'
|
6
|
+
|
7
|
+
import ElementUI from 'element-ui';
|
8
|
+
import 'element-ui/lib/theme-chalk/index.css';
|
9
|
+
|
10
|
+
Vue.use(ElementUI);
|
11
|
+
|
12
|
+
Vue.config.productionTip = false
|
13
|
+
|
14
|
+
|
15
|
+
new Vue({
|
16
|
+
router,
|
17
|
+
store,
|
18
|
+
render: h => h(App)
|
19
|
+
}).$mount('#app')
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/* eslint-disable no-console */
|
2
|
+
|
3
|
+
import { register } from 'register-service-worker'
|
4
|
+
|
5
|
+
if (process.env.NODE_ENV === 'production') {
|
6
|
+
register(`${process.env.BASE_URL}service-worker.js`, {
|
7
|
+
ready () {
|
8
|
+
console.log(
|
9
|
+
'App is being served from cache by a service worker.\n' +
|
10
|
+
'For more details, visit https://goo.gl/AFskqB'
|
11
|
+
)
|
12
|
+
},
|
13
|
+
registered () {
|
14
|
+
console.log('Service worker has been registered.')
|
15
|
+
},
|
16
|
+
cached () {
|
17
|
+
console.log('Content has been cached for offline use.')
|
18
|
+
},
|
19
|
+
updatefound () {
|
20
|
+
console.log('New content is downloading.')
|
21
|
+
},
|
22
|
+
updated () {
|
23
|
+
console.log('New content is available; please refresh.')
|
24
|
+
},
|
25
|
+
offline () {
|
26
|
+
console.log('No internet connection found. App is running in offline mode.')
|
27
|
+
},
|
28
|
+
error (error) {
|
29
|
+
console.error('Error during service worker registration:', error)
|
30
|
+
}
|
31
|
+
})
|
32
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import Vue from 'vue'
|
2
|
+
import VueRouter, { RouteConfig } from 'vue-router'
|
3
|
+
import HomeView from '../views/HomeView.vue'
|
4
|
+
|
5
|
+
Vue.use(VueRouter)
|
6
|
+
|
7
|
+
const routes: Array<RouteConfig> = [
|
8
|
+
{
|
9
|
+
path: '/',
|
10
|
+
name: 'home',
|
11
|
+
component: HomeView
|
12
|
+
},
|
13
|
+
{
|
14
|
+
path: '/about',
|
15
|
+
name: 'about',
|
16
|
+
// route level code-splitting
|
17
|
+
// this generates a separate chunk (about.[hash].js) for this route
|
18
|
+
// which is lazy-loaded when the route is visited.
|
19
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
|
20
|
+
}
|
21
|
+
]
|
22
|
+
|
23
|
+
const router = new VueRouter({
|
24
|
+
mode: 'history',
|
25
|
+
base: process.env.BASE_URL,
|
26
|
+
routes
|
27
|
+
})
|
28
|
+
|
29
|
+
export default router
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
const selectFile = (_options: any = { multiple: true }) => {
|
4
|
+
return new Promise((res, rej) => {
|
5
|
+
let options = {
|
6
|
+
accept: "*/*",
|
7
|
+
multiple: true,
|
8
|
+
};
|
9
|
+
if (_options) {
|
10
|
+
options.accept = _options.accept;
|
11
|
+
options.multiple = _options.multiple;
|
12
|
+
}
|
13
|
+
const el = document.createElement("input");
|
14
|
+
el.type = "file";
|
15
|
+
el.accept = options.accept;
|
16
|
+
el.multiple = options.multiple;
|
17
|
+
el.addEventListener("change", (_) => {
|
18
|
+
res(el.files);
|
19
|
+
});
|
20
|
+
el.click();
|
21
|
+
});
|
22
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="home">
|
3
|
+
<img alt="Vue logo" src="../assets/logo.png" />
|
4
|
+
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
|
5
|
+
</div>
|
6
|
+
</template>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import { Component, Vue } from "vue-property-decorator";
|
10
|
+
import HelloWorld from "@/components/HelloWorld.vue"; // @ is an alias to /src
|
11
|
+
import axios from "axios";
|
12
|
+
import $ from 'jquery'
|
13
|
+
|
14
|
+
@Component({
|
15
|
+
components: {
|
16
|
+
HelloWorld,
|
17
|
+
},
|
18
|
+
mounted() {
|
19
|
+
// console.log("测试", axios.post);
|
20
|
+
console.log("测试2", $);
|
21
|
+
|
22
|
+
axios.get("http://localhost:9528/").then((res: any) => {
|
23
|
+
console.log(res);
|
24
|
+
});
|
25
|
+
|
26
|
+
const arr = [1, 2]
|
27
|
+
console.log(arr[5]);
|
28
|
+
|
29
|
+
},
|
30
|
+
})
|
31
|
+
export default class HomeView extends Vue { }
|
32
|
+
</script>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/* eslint-disable arrow-body-style */
|
2
|
+
// https://docs.cypress.io/guides/guides/plugins-guide.html
|
3
|
+
|
4
|
+
// if you need a custom webpack configuration you can uncomment the following import
|
5
|
+
// and then use the `file:preprocessor` event
|
6
|
+
// as explained in the cypress docs
|
7
|
+
// https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples
|
8
|
+
|
9
|
+
// /* eslint-disable import/no-extraneous-dependencies, global-require */
|
10
|
+
// const webpack = require('@cypress/webpack-preprocessor')
|
11
|
+
|
12
|
+
module.exports = (on, config) => {
|
13
|
+
// on('file:preprocessor', webpack({
|
14
|
+
// webpackOptions: require('@vue/cli-service/webpack.config'),
|
15
|
+
// watchOptions: {}
|
16
|
+
// }))
|
17
|
+
|
18
|
+
return Object.assign({}, config, {
|
19
|
+
fixturesFolder: 'tests/e2e/fixtures',
|
20
|
+
integrationFolder: 'tests/e2e/specs',
|
21
|
+
screenshotsFolder: 'tests/e2e/screenshots',
|
22
|
+
videosFolder: 'tests/e2e/videos',
|
23
|
+
supportFile: 'tests/e2e/support/index.js'
|
24
|
+
})
|
25
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// ***********************************************
|
2
|
+
// This example commands.js shows you how to
|
3
|
+
// create various custom commands and overwrite
|
4
|
+
// existing commands.
|
5
|
+
//
|
6
|
+
// For more comprehensive examples of custom
|
7
|
+
// commands please read more here:
|
8
|
+
// https://on.cypress.io/custom-commands
|
9
|
+
// ***********************************************
|
10
|
+
//
|
11
|
+
//
|
12
|
+
// -- This is a parent command --
|
13
|
+
// Cypress.Commands.add("login", (email, password) => { ... })
|
14
|
+
//
|
15
|
+
//
|
16
|
+
// -- This is a child command --
|
17
|
+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
18
|
+
//
|
19
|
+
//
|
20
|
+
// -- This is a dual command --
|
21
|
+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
22
|
+
//
|
23
|
+
//
|
24
|
+
// -- This is will overwrite an existing command --
|
25
|
+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// ***********************************************************
|
2
|
+
// This example support/index.js is processed and
|
3
|
+
// loaded automatically before your test files.
|
4
|
+
//
|
5
|
+
// This is a great place to put global configuration and
|
6
|
+
// behavior that modifies Cypress.
|
7
|
+
//
|
8
|
+
// You can change the location of this file or turn off
|
9
|
+
// automatically serving support files with the
|
10
|
+
// 'supportFile' configuration option.
|
11
|
+
//
|
12
|
+
// You can read more here:
|
13
|
+
// https://on.cypress.io/configuration
|
14
|
+
// ***********************************************************
|
15
|
+
|
16
|
+
// Import commands.js using ES2015 syntax:
|
17
|
+
import './commands'
|
18
|
+
|
19
|
+
// Alternatively you can use CommonJS syntax:
|
20
|
+
// require('./commands')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
2
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
3
|
+
import Vue from 'vue'
|
4
|
+
|
5
|
+
describe('HelloWorld.vue', () => {
|
6
|
+
it('renders props.msg when passed', () => {
|
7
|
+
const msg = 'new message'
|
8
|
+
const wrapper = shallowMount(HelloWorld, {
|
9
|
+
propsData: { msg }
|
10
|
+
})
|
11
|
+
|
12
|
+
expect(wrapper.text()).toMatch(msg)
|
13
|
+
})
|
14
|
+
})
|
15
|
+
|
16
|
+
|
17
|
+
describe('HelloWorld.mounted', () => {
|
18
|
+
|
19
|
+
const HelloWorldVue = Vue.extend(HelloWorld);
|
20
|
+
const ListComponent = new HelloWorldVue().$mount();
|
21
|
+
|
22
|
+
it('调用方法', () => {
|
23
|
+
|
24
|
+
console.info(ListComponent);
|
25
|
+
|
26
|
+
|
27
|
+
})
|
28
|
+
})
|
package/tsconfig.json
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
{
|
2
|
+
"compileOnSave": false,
|
3
|
+
"compilerOptions": {
|
4
|
+
"outDir": "./dist/", // 打包到的目录
|
5
|
+
"sourceMap": true, // 是否生成sourceMap(用于浏览器调试)
|
6
|
+
"noImplicitAny": false,
|
7
|
+
"noUnusedLocals": true,
|
8
|
+
"noUnusedParameters": true,
|
9
|
+
"declaration": true, // 是否生成声明文件
|
10
|
+
"declarationDir": "./dist/types/", // 声明文件打包的位置
|
11
|
+
"declarationMap": false, // 是否生成声明文件map文件(便于调试)
|
12
|
+
"moduleResolution": "node",
|
13
|
+
"module": "esnext",
|
14
|
+
"target": "es5", // 转化成的目标语言
|
15
|
+
"baseUrl": "./",
|
16
|
+
"strict": true,
|
17
|
+
"jsx": "preserve",
|
18
|
+
"experimentalDecorators": true,
|
19
|
+
"skipLibCheck": true,
|
20
|
+
"esModuleInterop": true,
|
21
|
+
"allowSyntheticDefaultImports": true,
|
22
|
+
"forceConsistentCasingInFileNames": true,
|
23
|
+
"useDefineForClassFields": true,
|
24
|
+
"types": [
|
25
|
+
"node",
|
26
|
+
"webpack-env",
|
27
|
+
"jest",
|
28
|
+
"jquery"
|
29
|
+
],
|
30
|
+
"paths": {
|
31
|
+
"@/*": [
|
32
|
+
"src/*"
|
33
|
+
]
|
34
|
+
},
|
35
|
+
"typeRoots": [
|
36
|
+
"./node_modules/@types"
|
37
|
+
],
|
38
|
+
"lib": [
|
39
|
+
"dom",
|
40
|
+
"es2015",
|
41
|
+
"esnext",
|
42
|
+
"dom.iterable",
|
43
|
+
"scripthost"
|
44
|
+
],
|
45
|
+
"allowJs": false
|
46
|
+
},
|
47
|
+
"include": [
|
48
|
+
"src/**/*.ts",
|
49
|
+
"typings.d.ts",
|
50
|
+
"src/**/*.tsx",
|
51
|
+
"src/**/*.vue",
|
52
|
+
"tests/**/*.ts",
|
53
|
+
"tests/**/*.tsx"
|
54
|
+
], // 要打包的文件
|
55
|
+
"exclude": [
|
56
|
+
"node_modules",
|
57
|
+
"*.test.ts"
|
58
|
+
]
|
59
|
+
}
|
package/typings.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: ZY
|
3
|
+
* @Date: 2021-12-31 10:56:41
|
4
|
+
* @LastEditors: ZY
|
5
|
+
* @LastEditTime: 2021-12-31 10:57:00
|
6
|
+
* @FilePath: /3d-earth/typings.d.ts
|
7
|
+
* @Description: 文件描述
|
8
|
+
*/
|
9
|
+
declare module "*.png";
|
10
|
+
declare module "*.less";
|
11
|
+
declare module "*.svg";
|
12
|
+
declare module "*.json";
|
@@ -0,0 +1,76 @@
|
|
1
|
+
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
2
|
+
|
3
|
+
const path = require("path");
|
4
|
+
// const HtmlWebpackPlugin = require("html-webpack-plugin");
|
5
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
6
|
+
|
7
|
+
const isProduction = process.env.NODE_ENV == "production";
|
8
|
+
|
9
|
+
const stylesHandler = isProduction
|
10
|
+
? MiniCssExtractPlugin.loader
|
11
|
+
: "style-loader";
|
12
|
+
|
13
|
+
const config = {
|
14
|
+
entry: "./src/index.ts",
|
15
|
+
experiments: {
|
16
|
+
outputModule: true,
|
17
|
+
},
|
18
|
+
output: {
|
19
|
+
filename:'emacroh5lib.min.js',
|
20
|
+
path: path.resolve(__dirname, "dist"),
|
21
|
+
library: {
|
22
|
+
// do not specify a `name` here
|
23
|
+
type: 'module',
|
24
|
+
},
|
25
|
+
},
|
26
|
+
devServer: {
|
27
|
+
open: true,
|
28
|
+
host: "localhost",
|
29
|
+
},
|
30
|
+
plugins: [
|
31
|
+
// new HtmlWebpackPlugin({
|
32
|
+
// template: "index.html",
|
33
|
+
// }),
|
34
|
+
|
35
|
+
// Add your plugins here
|
36
|
+
// Learn more about plugins from https://webpack.js.org/configuration/plugins/
|
37
|
+
],
|
38
|
+
module: {
|
39
|
+
rules: [
|
40
|
+
{
|
41
|
+
test: /\.(ts|tsx)$/i,
|
42
|
+
loader: "ts-loader",
|
43
|
+
exclude: ["/node_modules/"],
|
44
|
+
},
|
45
|
+
{
|
46
|
+
test: /\.less$/i,
|
47
|
+
use: [stylesHandler, "css-loader", "postcss-loader", "less-loader"],
|
48
|
+
},
|
49
|
+
{
|
50
|
+
test: /\.css$/i,
|
51
|
+
use: [stylesHandler, "css-loader", "postcss-loader"],
|
52
|
+
},
|
53
|
+
{
|
54
|
+
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
55
|
+
type: "asset/inline"
|
56
|
+
},
|
57
|
+
|
58
|
+
// Add your rules for custom modules here
|
59
|
+
// Learn more about loaders from https://webpack.js.org/loaders/
|
60
|
+
],
|
61
|
+
},
|
62
|
+
resolve: {
|
63
|
+
extensions: [".tsx", ".ts", ".js"],
|
64
|
+
},
|
65
|
+
};
|
66
|
+
|
67
|
+
module.exports = () => {
|
68
|
+
if (isProduction) {
|
69
|
+
config.mode = "production";
|
70
|
+
|
71
|
+
config.plugins.push(new MiniCssExtractPlugin());
|
72
|
+
} else {
|
73
|
+
config.mode = "development";
|
74
|
+
}
|
75
|
+
return config;
|
76
|
+
};
|