emacroh5lib 1.0.1 → 1.0.2
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/README.md +1 -1
- package/package.json +8 -6
- package/src/components/HelloWorld.vue +3 -3
- package/src/components/MessageBox.jsx +1 -0
- package/src/components/MessageBoxTest.tsx +11 -0
- package/src/index.ts +32 -12
- package/src/main.ts +3 -1
- package/src/router/index.ts +3 -3
- package/src/shims-vue.d.ts +1 -1
- package/src/utilities/File.ts +6 -2
- package/src/views/{File → FileViewer}/index.less +1 -0
- package/src/views/FileViewer/index.vue +78 -0
- package/src/views/HomeView.vue +2 -0
- package/src/vue-prototype.d.ts +7 -0
- package/tsconfig.json +2 -1
- package/typings.d.ts +1 -1
- package/webpack.config.js +21 -2
- package/src/views/File/index.vue +0 -74
package/README.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "emacroh5lib",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "EMacro前端组件库",
|
5
5
|
"main": "./dist/emacroh5lib.min.js",
|
6
6
|
"types": "./dist/types/index.d.ts",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"e2e": "vue-cli-service test:e2e",
|
14
14
|
"watch": "webpack --watch",
|
15
15
|
"serve": "webpack serve",
|
16
|
-
"dev": "
|
16
|
+
"dev": "vue-cli-service test:e2e",
|
17
17
|
"commit": "cz",
|
18
18
|
"test": "echo \"Error: no test specified\" && exit 1"
|
19
19
|
},
|
@@ -66,6 +66,8 @@
|
|
66
66
|
"ts-jest": "^27.1.4",
|
67
67
|
"ts-loader": "^9.2.8",
|
68
68
|
"typescript": "^4.6.3",
|
69
|
+
"vue-loader": "^15.7.0",
|
70
|
+
"vue-router": "^3.1.3",
|
69
71
|
"vue-template-compiler": "^2.6.14",
|
70
72
|
"webpack": "^5.72.0",
|
71
73
|
"webpack-cli": "^4.9.2",
|
@@ -77,11 +79,13 @@
|
|
77
79
|
"@vue/cli-plugin-typescript": "^5.0.4",
|
78
80
|
"axios": "^0.26.1",
|
79
81
|
"core-js": "^3.22.2",
|
82
|
+
"deep-eql": "^4.0.0",
|
80
83
|
"echarts": "^5.3.2",
|
81
84
|
"echarts-gl": "^2.0.9",
|
82
85
|
"element-ui": "^2.15.8",
|
83
86
|
"jquery": "^3.6.0",
|
84
87
|
"js-cookie": "^3.0.1",
|
88
|
+
"query-string": "^7.0.1",
|
85
89
|
"register-service-worker": "^1.7.2",
|
86
90
|
"three": "^0.139.2",
|
87
91
|
"typings": "^2.1.1",
|
@@ -89,10 +93,8 @@
|
|
89
93
|
"vue-class-component": "^7.2.3",
|
90
94
|
"vue-echarts": "^6.0.2",
|
91
95
|
"vue-property-decorator": "^9.1.2",
|
92
|
-
"vue-
|
96
|
+
"vue-tsx-support": "^3.2.0",
|
93
97
|
"vuex": "^3.6.2",
|
94
|
-
"xlsx": "^0.18.5"
|
95
|
-
"query-string": "^7.0.1",
|
96
|
-
"deep-eql": "^4.0.0"
|
98
|
+
"xlsx": "^0.18.5"
|
97
99
|
}
|
98
100
|
}
|
@@ -83,11 +83,11 @@
|
|
83
83
|
<script lang="ts">
|
84
84
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
85
85
|
|
86
|
-
@Component
|
86
|
+
@Component({ name: "HelloWorld" })
|
87
87
|
export default class HelloWorld extends Vue {
|
88
|
-
@Prop() private msg!: string;
|
88
|
+
@Prop() private msg!: string;
|
89
89
|
|
90
|
-
public test():void{
|
90
|
+
public test(): void {
|
91
91
|
|
92
92
|
console.log(this.msg);
|
93
93
|
|
@@ -102,6 +102,7 @@ export default {
|
|
102
102
|
render() {
|
103
103
|
return (
|
104
104
|
<div>
|
105
|
+
<div>你好撒发射点 </div>
|
105
106
|
<a-select show-search placeholder={this.placeholder} option-filter-prop="children" style={this.css}
|
106
107
|
onfocus={this.focus} onblur={this.blur} onchange={this.change} oninputKeydown={this.inputKeydown} defaultValue={this.defaultValue}>
|
107
108
|
{
|
package/src/index.ts
CHANGED
@@ -1,21 +1,41 @@
|
|
1
1
|
|
2
|
+
import { EMacro } from "./utilities/File";
|
3
|
+
|
4
|
+
|
5
|
+
import FileViewer from './views/FileViewer/index.vue'
|
6
|
+
import MessageBoxTest from "@/components/MessageBoxTest";
|
7
|
+
|
8
|
+
const components = [FileViewer];
|
9
|
+
|
10
|
+
const install = (Vue: any) => {
|
11
|
+
if ((install as any).installed) return;
|
12
|
+
(install as any).installed = true;
|
13
|
+
components.map((component) => {
|
14
|
+
Vue.component(component.name, component);
|
15
|
+
});
|
16
|
+
};
|
17
|
+
// 这一步判断window.Vue是否存在,因为直接引用vue.min.js, 它会把Vue绑到Window上,我们直接引用打包好的js才能正常跑起来。
|
18
|
+
if (typeof window !== 'undefined' && (window as any).Vue) {
|
19
|
+
// window.Vue.use(install)
|
20
|
+
install((window as any).Vue);
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
// import HelloWorld from "@/components/HelloWorld.vue";
|
28
|
+
// import HelloWorld from "@/components/index";
|
29
|
+
|
30
|
+
|
31
|
+
|
2
32
|
|
3
|
-
class Test {
|
4
33
|
|
5
|
-
public static print(info: string): void {
|
6
|
-
console.log(info);
|
7
34
|
|
8
|
-
console.log('测试npm');
|
9
35
|
|
10
|
-
const arr = [1, 2]
|
11
|
-
console.log(arr[5]);
|
12
36
|
|
13
|
-
console.log('测试npm22');
|
14
|
-
console.log('测试npm33333');
|
15
37
|
|
16
|
-
}
|
17
38
|
|
18
|
-
}
|
19
39
|
|
20
|
-
export default
|
21
|
-
export { }
|
40
|
+
export default {}
|
41
|
+
export { EMacro, FileViewer }
|
package/src/main.ts
CHANGED
package/src/router/index.ts
CHANGED
@@ -19,9 +19,9 @@ const routes: Array<RouteConfig> = [
|
|
19
19
|
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
|
20
20
|
},
|
21
21
|
{
|
22
|
-
path: '/
|
23
|
-
name: '
|
24
|
-
component: () => import('../views/
|
22
|
+
path: '/FileViewer',
|
23
|
+
name: 'FileViewer',
|
24
|
+
component: () => import('../views/FileViewer/index.vue')
|
25
25
|
},
|
26
26
|
]
|
27
27
|
|
package/src/shims-vue.d.ts
CHANGED
package/src/utilities/File.ts
CHANGED
@@ -0,0 +1,78 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="app-container">
|
3
|
+
|
4
|
+
<div style="background-color: #42b983; color: red;">
|
5
|
+
zxcxzcxzcz
|
6
|
+
<span>测试</span>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<button @click="test2($event)" class="click-button">点击事件</button>
|
10
|
+
|
11
|
+
</div>
|
12
|
+
</template>
|
13
|
+
|
14
|
+
<script lang="ts">
|
15
|
+
|
16
|
+
import { Component, Prop, Vue } from "vue-property-decorator";
|
17
|
+
|
18
|
+
import $ from "jquery";
|
19
|
+
|
20
|
+
import * as echarts from "echarts";
|
21
|
+
|
22
|
+
@Component({
|
23
|
+
components: {}
|
24
|
+
})
|
25
|
+
@Component({ name: 'FileViewer' })
|
26
|
+
export default class FileViewer extends Vue {
|
27
|
+
@Prop(Number) readonly msg!: number | undefined;
|
28
|
+
@Prop() private name!: string;
|
29
|
+
|
30
|
+
public static entryName = 'FileViewer';
|
31
|
+
private currentTime = "";
|
32
|
+
|
33
|
+
public data_0 = {
|
34
|
+
page_index: 0,
|
35
|
+
page_size: 3,
|
36
|
+
data: [
|
37
|
+
{ a: "面料类", b: "16500", c: "12063", d: "45.5%" },
|
38
|
+
{ a: "面料类", b: "26500", c: "12063", d: "45.5%" },
|
39
|
+
{ a: "面料类", b: "36500", c: "12063", d: "45.5%" },
|
40
|
+
{ a: "面料类", b: "46500", c: "12063", d: "45.5%" },
|
41
|
+
{ a: "面料类", b: "56500", c: "12063", d: "45.5%" },
|
42
|
+
],
|
43
|
+
};
|
44
|
+
|
45
|
+
// 计算属性
|
46
|
+
private get reversedMessage(): string {
|
47
|
+
return this.currentTime;
|
48
|
+
}
|
49
|
+
|
50
|
+
private test2(e): void {
|
51
|
+
alert("你好")
|
52
|
+
console.log('event', e);
|
53
|
+
}
|
54
|
+
|
55
|
+
public test1(): void {
|
56
|
+
// EMacro.File.readLocalExcel((file, workbook) => {
|
57
|
+
// console.log("file", file);
|
58
|
+
// console.log("workbook", workbook);
|
59
|
+
// console.log("数据", workbook.Sheets["工作表1"]["G32"].h);
|
60
|
+
// });
|
61
|
+
}
|
62
|
+
|
63
|
+
// 生命周期
|
64
|
+
private created(): void { }
|
65
|
+
private mounted(): void {
|
66
|
+
this.$nextTick(() => {
|
67
|
+
// console.log("调用", EMacro);
|
68
|
+
});
|
69
|
+
}
|
70
|
+
private updated(): void { }
|
71
|
+
private destroyed(): void { }
|
72
|
+
|
73
|
+
}
|
74
|
+
</script>
|
75
|
+
|
76
|
+
<style lang="less" scoped>
|
77
|
+
@import "index.less";
|
78
|
+
</style>
|
package/src/views/HomeView.vue
CHANGED
@@ -8,12 +8,14 @@
|
|
8
8
|
<script lang="ts">
|
9
9
|
import { Component, Vue } from "vue-property-decorator";
|
10
10
|
import HelloWorld from "@/components/HelloWorld.vue"; // @ is an alias to /src
|
11
|
+
import MessageBoxTest from "@/components/MessageBoxTest";
|
11
12
|
import axios from "axios";
|
12
13
|
import $ from 'jquery'
|
13
14
|
|
14
15
|
@Component({
|
15
16
|
components: {
|
16
17
|
HelloWorld,
|
18
|
+
MessageBoxTest
|
17
19
|
},
|
18
20
|
mounted() {
|
19
21
|
// console.log("测试", axios.post);
|
package/tsconfig.json
CHANGED
@@ -33,6 +33,7 @@
|
|
33
33
|
]
|
34
34
|
},
|
35
35
|
"typeRoots": [
|
36
|
+
"/@types",
|
36
37
|
"./node_modules/@types"
|
37
38
|
],
|
38
39
|
"lib": [
|
@@ -51,7 +52,7 @@
|
|
51
52
|
"src/**/*.vue",
|
52
53
|
"tests/**/*.ts",
|
53
54
|
"tests/**/*.tsx"
|
54
|
-
], // 要打包的文件
|
55
|
+
, "src/components/MessageBox.tsx" ], // 要打包的文件
|
55
56
|
"exclude": [
|
56
57
|
"node_modules",
|
57
58
|
"*.test.ts"
|
package/typings.d.ts
CHANGED
package/webpack.config.js
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
const path = require("path");
|
4
4
|
// const HtmlWebpackPlugin = require("html-webpack-plugin");
|
5
5
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
6
|
+
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
7
|
+
|
6
8
|
const webpack = require('webpack');
|
7
9
|
|
8
10
|
const isProduction = process.env.NODE_ENV == "production";
|
@@ -22,6 +24,7 @@ const config = {
|
|
22
24
|
},
|
23
25
|
output: {
|
24
26
|
filename: 'emacroh5lib.min.js',
|
27
|
+
// publicPath: process.env.NODE_ENV === "development" ? "/" : "/emacroh5lib/",
|
25
28
|
path: path.resolve(__dirname, "dist"),
|
26
29
|
library: {
|
27
30
|
// do not specify a `name` here
|
@@ -48,9 +51,24 @@ const config = {
|
|
48
51
|
],
|
49
52
|
module: {
|
50
53
|
rules: [
|
54
|
+
{
|
55
|
+
test: /\.(vue)$/,
|
56
|
+
use: [
|
57
|
+
{
|
58
|
+
loader: 'vue-loader',
|
59
|
+
options: {
|
60
|
+
esModule: false
|
61
|
+
}
|
62
|
+
}
|
63
|
+
]
|
64
|
+
},
|
51
65
|
{
|
52
66
|
test: /\.(ts|tsx)$/i,
|
53
67
|
loader: "ts-loader",
|
68
|
+
options: {
|
69
|
+
appendTsSuffixTo: [/\.(vue)$/],
|
70
|
+
transpileOnly: true //只进行语法转换, 不进行类型校验, 提高构建速度
|
71
|
+
},
|
54
72
|
exclude: ["/node_modules/"],
|
55
73
|
},
|
56
74
|
{
|
@@ -62,7 +80,7 @@ const config = {
|
|
62
80
|
use: [stylesHandler, "css-loader", "postcss-loader"],
|
63
81
|
},
|
64
82
|
{
|
65
|
-
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
83
|
+
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif|ico)$/i,
|
66
84
|
type: "asset/inline"
|
67
85
|
},
|
68
86
|
|
@@ -75,7 +93,7 @@ const config = {
|
|
75
93
|
alias: {
|
76
94
|
'@': resolve('src')
|
77
95
|
},
|
78
|
-
extensions: [
|
96
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
|
79
97
|
}
|
80
98
|
};
|
81
99
|
|
@@ -84,6 +102,7 @@ module.exports = () => {
|
|
84
102
|
config.mode = "production";
|
85
103
|
|
86
104
|
config.plugins.push(new MiniCssExtractPlugin());
|
105
|
+
config.plugins.push(new VueLoaderPlugin());
|
87
106
|
} else {
|
88
107
|
config.mode = "development";
|
89
108
|
}
|
package/src/views/File/index.vue
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="app-container">
|
3
|
-
<button class="click-button" @click="test1">读取excel</button>
|
4
|
-
</div>
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import { Component, Prop, Vue } from "vue-property-decorator";
|
9
|
-
|
10
|
-
import $ from "jquery";
|
11
|
-
|
12
|
-
import * as echarts from "echarts";
|
13
|
-
import EMacro from "../../utilities/File";
|
14
|
-
|
15
|
-
/// <reference path = "../../utilities/File.ts" />
|
16
|
-
|
17
|
-
@Component({
|
18
|
-
components: {},
|
19
|
-
})
|
20
|
-
@Component
|
21
|
-
export default class Page extends Vue {
|
22
|
-
@Prop(Number) readonly msg!: number | undefined;
|
23
|
-
@Prop() private name!: string;
|
24
|
-
|
25
|
-
private currentTime = "";
|
26
|
-
|
27
|
-
public data_0 = {
|
28
|
-
page_index: 0,
|
29
|
-
page_size: 3,
|
30
|
-
data: [
|
31
|
-
{ a: "面料类", b: "16500", c: "12063", d: "45.5%" },
|
32
|
-
{ a: "面料类", b: "26500", c: "12063", d: "45.5%" },
|
33
|
-
{ a: "面料类", b: "36500", c: "12063", d: "45.5%" },
|
34
|
-
{ a: "面料类", b: "46500", c: "12063", d: "45.5%" },
|
35
|
-
{ a: "面料类", b: "56500", c: "12063", d: "45.5%" },
|
36
|
-
],
|
37
|
-
};
|
38
|
-
|
39
|
-
// 计算属性
|
40
|
-
private get reversedMessage(): string {
|
41
|
-
return this.currentTime;
|
42
|
-
}
|
43
|
-
|
44
|
-
public test1(): void {
|
45
|
-
EMacro.File.readLocalExcel((file, workbook) => {
|
46
|
-
console.log("file", file);
|
47
|
-
console.log("workbook", workbook);
|
48
|
-
console.log("数据", workbook.Sheets["工作表1"]["G32"].h);
|
49
|
-
});
|
50
|
-
}
|
51
|
-
|
52
|
-
// 生命周期
|
53
|
-
private created(): void {}
|
54
|
-
private mounted(): void {
|
55
|
-
this.$nextTick(() => {
|
56
|
-
console.log("调用", EMacro);
|
57
|
-
});
|
58
|
-
}
|
59
|
-
private updated(): void {}
|
60
|
-
private destroyed(): void {}
|
61
|
-
}
|
62
|
-
</script>
|
63
|
-
|
64
|
-
<style lang="less" scoped>
|
65
|
-
@import "index.less";
|
66
|
-
|
67
|
-
.app-container /deep/ .el-table .unchecked {
|
68
|
-
background: rgba(255, 192, 203, 0.35) !important;
|
69
|
-
|
70
|
-
td {
|
71
|
-
color: #fff !important;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
</style>
|