emacroh5lib 1.0.14 → 1.0.18
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/dist/emacroh5lib.min.js +1 -1
- package/dist/main.css +0 -61
- package/package.json +1 -1
- package/src/index.ts +4 -3
- package/src/views/DragResizeView/vue-drag-resize.js +2 -1
- package/src/views/DragResizeViewTs/index.less +59 -0
- package/src/views/DragResizeViewTs/index.vue +904 -0
- package/src/views/Draw/index.less +98 -0
- package/src/views/Draw/index.vue +423 -0
- package/src/views/TestView/index.less +1 -0
- package/src/views/TestView/index.vue +6 -5
- package/tsconfig.json +4 -4
- package/webpack.config.js +3 -1
@@ -0,0 +1,98 @@
|
|
1
|
+
.vdr {
|
2
|
+
width: 100%;
|
3
|
+
height: 100%;
|
4
|
+
background-color: transparent;
|
5
|
+
position: absolute;
|
6
|
+
}
|
7
|
+
|
8
|
+
.vdr.active:before {
|
9
|
+
content: '';
|
10
|
+
width: 100%;
|
11
|
+
height: 100%;
|
12
|
+
position: absolute;
|
13
|
+
top: 0;
|
14
|
+
left: 0;
|
15
|
+
box-sizing: border-box;
|
16
|
+
outline: 1px dashed #d6d6d6;
|
17
|
+
|
18
|
+
|
19
|
+
}
|
20
|
+
|
21
|
+
.vdr-stick {
|
22
|
+
box-sizing: border-box;
|
23
|
+
position: absolute;
|
24
|
+
font-size: 1px;
|
25
|
+
background: #ffffff;
|
26
|
+
border: 2px solid #6c6c6c;
|
27
|
+
box-shadow: 0 0 2px #bbb;
|
28
|
+
pointer-events: visible;
|
29
|
+
}
|
30
|
+
|
31
|
+
.inactive .vdr-stick {
|
32
|
+
display: none;
|
33
|
+
}
|
34
|
+
|
35
|
+
.vdr-stick-tl,
|
36
|
+
.vdr-stick-br {
|
37
|
+
cursor: nwse-resize;
|
38
|
+
}
|
39
|
+
|
40
|
+
.vdr-stick-tm,
|
41
|
+
.vdr-stick-bm {
|
42
|
+
left: 50%;
|
43
|
+
cursor: ns-resize;
|
44
|
+
}
|
45
|
+
|
46
|
+
.vdr-stick-tr,
|
47
|
+
.vdr-stick-bl {
|
48
|
+
cursor: nesw-resize;
|
49
|
+
}
|
50
|
+
|
51
|
+
.vdr-stick-ml,
|
52
|
+
.vdr-stick-mr {
|
53
|
+
top: 50%;
|
54
|
+
cursor: ew-resize;
|
55
|
+
}
|
56
|
+
|
57
|
+
.vdr-stick.not-resizable {
|
58
|
+
display: none;
|
59
|
+
}
|
60
|
+
|
61
|
+
.content-container {
|
62
|
+
display: block;
|
63
|
+
position: relative;
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
.tl{
|
68
|
+
position: absolute;
|
69
|
+
top: -2px;
|
70
|
+
left: -2px;
|
71
|
+
width: 4px !important;
|
72
|
+
height: 4px !important;
|
73
|
+
background-color: #f00;
|
74
|
+
pointer-events: visible;
|
75
|
+
cursor: nwse-resize;
|
76
|
+
}
|
77
|
+
|
78
|
+
.lm{
|
79
|
+
position: absolute;
|
80
|
+
top: calc(50% - 2px);
|
81
|
+
left: -2px;
|
82
|
+
width: 4px !important;
|
83
|
+
height: 4px !important;
|
84
|
+
background-color: #fff;
|
85
|
+
pointer-events: visible;
|
86
|
+
cursor: ew-resize;
|
87
|
+
}
|
88
|
+
|
89
|
+
.lb{
|
90
|
+
position: absolute;
|
91
|
+
bottom: -2px;
|
92
|
+
left: -2px;
|
93
|
+
width: 4px !important;
|
94
|
+
height: 4px !important;
|
95
|
+
background-color: #f00;
|
96
|
+
pointer-events: visible;
|
97
|
+
cursor: nesw-resize;
|
98
|
+
}
|
@@ -0,0 +1,423 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="vdr" :style="containerStyle">
|
3
|
+
|
4
|
+
|
5
|
+
<slot>
|
6
|
+
</slot>
|
7
|
+
|
8
|
+
<div ref="sticks" :style="sticksStyle">
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<div class="tl"></div>
|
13
|
+
<div class="lm"></div>
|
14
|
+
<div class="lb"></div>
|
15
|
+
|
16
|
+
|
17
|
+
</div>
|
18
|
+
|
19
|
+
|
20
|
+
</div>
|
21
|
+
</template>
|
22
|
+
|
23
|
+
<script lang="ts">
|
24
|
+
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
25
|
+
|
26
|
+
const styleMapping: any = {
|
27
|
+
y: {
|
28
|
+
t: 'top',
|
29
|
+
m: 'marginTop',
|
30
|
+
b: 'bottom',
|
31
|
+
},
|
32
|
+
x: {
|
33
|
+
l: 'left',
|
34
|
+
m: 'marginLeft',
|
35
|
+
r: 'right',
|
36
|
+
},
|
37
|
+
};
|
38
|
+
|
39
|
+
function addEvents(events: any) {
|
40
|
+
events.forEach((cb: any, eventName: string) => {
|
41
|
+
document.documentElement.addEventListener(eventName, cb);
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
@Component({
|
46
|
+
components: {}
|
47
|
+
})
|
48
|
+
export default class DrawView extends Vue {
|
49
|
+
|
50
|
+
@Prop({
|
51
|
+
type: String,
|
52
|
+
required: false,
|
53
|
+
default: ''
|
54
|
+
}) name!: string;
|
55
|
+
|
56
|
+
|
57
|
+
//#region
|
58
|
+
|
59
|
+
|
60
|
+
@Prop({ type: Number, default: 8 }) stickSize!: number;
|
61
|
+
@Prop({ type: Number, default: 1 }) parentScaleX!: number;
|
62
|
+
@Prop({ type: Number, default: 1 }) parentScaleY!: number;
|
63
|
+
@Prop({ type: Boolean, default: false, }) isActive!: boolean;
|
64
|
+
@Prop({ type: Boolean, default: false, }) preventActiveBehavior!: boolean;
|
65
|
+
@Prop({ type: Boolean, default: true, }) isDraggable!: boolean;
|
66
|
+
@Prop({ type: Boolean, default: true, }) isResizable!: boolean;
|
67
|
+
@Prop({ type: Boolean, default: false, }) aspectRatio!: boolean;
|
68
|
+
@Prop({
|
69
|
+
type: Boolean, default: false,
|
70
|
+
}) parentLimitation!: boolean;
|
71
|
+
@Prop({
|
72
|
+
type: Boolean, default: false,
|
73
|
+
}) snapToGrid!: number;
|
74
|
+
|
75
|
+
@Prop({
|
76
|
+
type: Number,
|
77
|
+
default: 50,
|
78
|
+
validator(val) {
|
79
|
+
return val >= 0;
|
80
|
+
},
|
81
|
+
}) gridX!: number;
|
82
|
+
|
83
|
+
@Prop({
|
84
|
+
type: Number,
|
85
|
+
default: 50,
|
86
|
+
validator(val) {
|
87
|
+
return val >= 0;
|
88
|
+
},
|
89
|
+
}) gridY!: number;
|
90
|
+
|
91
|
+
@Prop({
|
92
|
+
type: Number,
|
93
|
+
default: 0,
|
94
|
+
validator(val) {
|
95
|
+
return val >= 0;
|
96
|
+
},
|
97
|
+
}) parentW!: number;
|
98
|
+
|
99
|
+
@Prop({
|
100
|
+
type: Number,
|
101
|
+
default: 0,
|
102
|
+
validator(val) {
|
103
|
+
return val >= 0;
|
104
|
+
},
|
105
|
+
}) parentH!: number;
|
106
|
+
|
107
|
+
@Prop({
|
108
|
+
type: [String, Number],
|
109
|
+
default: 200,
|
110
|
+
validator(val) {
|
111
|
+
return (typeof val === 'string') ? val === 'auto' : val >= 0;
|
112
|
+
},
|
113
|
+
}) w!: any;
|
114
|
+
|
115
|
+
@Prop({
|
116
|
+
type: [String, Number],
|
117
|
+
default: 200,
|
118
|
+
validator(val) {
|
119
|
+
return (typeof val === 'string') ? val === 'auto' : val >= 0;
|
120
|
+
},
|
121
|
+
}) h!: any;
|
122
|
+
|
123
|
+
@Prop({
|
124
|
+
type: Number,
|
125
|
+
default: 50,
|
126
|
+
validator(val) {
|
127
|
+
return val >= 0;
|
128
|
+
},
|
129
|
+
}) minw!: number;
|
130
|
+
|
131
|
+
@Prop({
|
132
|
+
type: Number,
|
133
|
+
default: 50,
|
134
|
+
validator(val) {
|
135
|
+
return val >= 0;
|
136
|
+
},
|
137
|
+
}) minh!: number;
|
138
|
+
|
139
|
+
@Prop({
|
140
|
+
type: Number,
|
141
|
+
default: 0,
|
142
|
+
validator(val) {
|
143
|
+
return typeof val === 'number';
|
144
|
+
},
|
145
|
+
}) x!: number;
|
146
|
+
|
147
|
+
@Prop({
|
148
|
+
type: Number,
|
149
|
+
default: 0,
|
150
|
+
validator(val) {
|
151
|
+
return typeof val === 'number';
|
152
|
+
},
|
153
|
+
}) y!: number;
|
154
|
+
@Prop({
|
155
|
+
type: [String, Number],
|
156
|
+
default: 'auto',
|
157
|
+
validator(val) {
|
158
|
+
return (typeof val === 'string') ? val === 'auto' : val >= 0;
|
159
|
+
},
|
160
|
+
}) z!: string | number;
|
161
|
+
@Prop({
|
162
|
+
type: String,
|
163
|
+
default: null,
|
164
|
+
}) dragHandle!: string;
|
165
|
+
|
166
|
+
@Prop({
|
167
|
+
type: String,
|
168
|
+
default: null,
|
169
|
+
}) dragCancel!: string;
|
170
|
+
|
171
|
+
@Prop({
|
172
|
+
type: Array,
|
173
|
+
default() {
|
174
|
+
return ['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'];
|
175
|
+
},
|
176
|
+
}) sticks!: Array<string>;
|
177
|
+
|
178
|
+
@Prop({
|
179
|
+
type: String,
|
180
|
+
default: 'both',
|
181
|
+
validator(val) {
|
182
|
+
return ['x', 'y', 'both', 'none'].indexOf(val) !== -1;
|
183
|
+
},
|
184
|
+
}) axis!: string;
|
185
|
+
|
186
|
+
@Prop({
|
187
|
+
type: String,
|
188
|
+
required: false,
|
189
|
+
default: '',
|
190
|
+
}) contentClass!: boolean;
|
191
|
+
|
192
|
+
@Prop({
|
193
|
+
type: Boolean,
|
194
|
+
required: false,
|
195
|
+
default: false
|
196
|
+
}) isStorage!: boolean;
|
197
|
+
|
198
|
+
public fixAspectRatio = null
|
199
|
+
public active = false
|
200
|
+
public zIndex: number = 0;
|
201
|
+
public parentWidth = 0;
|
202
|
+
public parentHeight = 0;
|
203
|
+
public left = 0;
|
204
|
+
public top = 0;
|
205
|
+
public right = 50;
|
206
|
+
public bottom = 50;
|
207
|
+
public minHeight = 10;
|
208
|
+
public stickDrag = false;
|
209
|
+
public bodyDrag = false;
|
210
|
+
public dimensionsBeforeMove: any;
|
211
|
+
public limits: any;
|
212
|
+
public currentStick: any;
|
213
|
+
public aspectFactor: any;
|
214
|
+
public domEvents: any;
|
215
|
+
public parentElement: any;
|
216
|
+
public _uid: any;
|
217
|
+
|
218
|
+
public slot!: HTMLElement;
|
219
|
+
|
220
|
+
width = 10
|
221
|
+
height = 10
|
222
|
+
|
223
|
+
//#endregion
|
224
|
+
|
225
|
+
|
226
|
+
get vdrStick() {
|
227
|
+
return (stick: any) => {
|
228
|
+
const stickStyle: any = {
|
229
|
+
width: `${this.stickSize / this.parentScaleX}px`,
|
230
|
+
height: `${this.stickSize / this.parentScaleY}px`
|
231
|
+
};
|
232
|
+
stickStyle[styleMapping.y[stick[0]]] = `${this.stickSize / this.parentScaleX / -2}px`;
|
233
|
+
stickStyle[styleMapping.x[stick[1]]] = `${this.stickSize / this.parentScaleX / -2}px`;
|
234
|
+
return stickStyle;
|
235
|
+
};
|
236
|
+
}
|
237
|
+
|
238
|
+
get containerStyle() {
|
239
|
+
return {
|
240
|
+
top: this.top + 'px',
|
241
|
+
left: this.left + 'px',
|
242
|
+
boxSizing: "border-box",
|
243
|
+
position: "absolute",
|
244
|
+
};
|
245
|
+
}
|
246
|
+
|
247
|
+
get sticksStyle() {
|
248
|
+
|
249
|
+
return {
|
250
|
+
top: '0px',
|
251
|
+
left: '0px',
|
252
|
+
zIndex: 0,
|
253
|
+
boxSizing: "border-box",
|
254
|
+
position: "relative",
|
255
|
+
width: this.width + 'px',
|
256
|
+
height: this.height + 'px',
|
257
|
+
pointerEvents: "none"
|
258
|
+
};
|
259
|
+
}
|
260
|
+
|
261
|
+
// get contentStyle(){
|
262
|
+
// return {
|
263
|
+
// top: this.top + 'px',
|
264
|
+
// left: this.left + 'px',
|
265
|
+
// zIndex: this.zIndex,
|
266
|
+
// position: "absolute",
|
267
|
+
// boxSizing: "border-box",
|
268
|
+
// width: this.width + "px",
|
269
|
+
// height: this.height + "px",
|
270
|
+
// };
|
271
|
+
// }
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
beforeCreate() {
|
276
|
+
this.stickDrag = false;
|
277
|
+
this.stickDrag = false;
|
278
|
+
this.bodyDrag = false;
|
279
|
+
this.bodyDrag = false;
|
280
|
+
this.dimensionsBeforeMove = { pointerX: 0, pointerY: 0, x: 0, y: 0, w: 0, h: 0 };
|
281
|
+
this.limits = {
|
282
|
+
left: { min: null, max: null },
|
283
|
+
right: { min: null, max: null },
|
284
|
+
top: { min: null, max: null },
|
285
|
+
bottom: { min: null, max: null },
|
286
|
+
};
|
287
|
+
|
288
|
+
this.currentStick = null;
|
289
|
+
}
|
290
|
+
|
291
|
+
|
292
|
+
deselect() {
|
293
|
+
// if (this.preventActiveBehavior) {
|
294
|
+
// return;
|
295
|
+
// }
|
296
|
+
// this.active = true;
|
297
|
+
}
|
298
|
+
|
299
|
+
mounted() {
|
300
|
+
|
301
|
+
// this.parentElement = this.$el.parentNode;
|
302
|
+
// this.parentWidth = this.parentW ? this.parentW : this.parentElement.clientWidth;
|
303
|
+
// this.parentHeight = this.parentH ? this.parentH : this.parentElement.clientHeight;
|
304
|
+
|
305
|
+
this.$nextTick(() => {
|
306
|
+
// console.log("父元素", this.$slots.test);
|
307
|
+
|
308
|
+
|
309
|
+
// let style = window.getComputedStyle(this.$slots.default[0].elm, null);
|
310
|
+
// let style = window.getDefaultComputedStyle(this.$slots.default[0].elm, null);
|
311
|
+
|
312
|
+
// console.log("父元素", style);
|
313
|
+
console.log("父元素", this.$slots.default![0]);
|
314
|
+
|
315
|
+
this.width = this.slot.clientWidth
|
316
|
+
this.height = this.slot.clientHeight
|
317
|
+
console.log("宽度", this.slot.clientHeight);
|
318
|
+
|
319
|
+
})
|
320
|
+
|
321
|
+
|
322
|
+
let start = { x: 0, y: 0 };
|
323
|
+
|
324
|
+
this.slot = this.$slots.default![0].elm as HTMLElement;
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
this.slot.addEventListener("mousemove", (e) => {
|
329
|
+
|
330
|
+
if (!this.active)
|
331
|
+
return
|
332
|
+
|
333
|
+
// this.active = false
|
334
|
+
|
335
|
+
// console.log("mousemove pageX", e.pageX);
|
336
|
+
// console.log("mousemove", start);
|
337
|
+
|
338
|
+
let l = e.pageX - start.x
|
339
|
+
let t = e.pageY - start.y
|
340
|
+
|
341
|
+
this.top = Math.floor(this.top + t)
|
342
|
+
this.left = Math.floor(this.left + l)
|
343
|
+
|
344
|
+
start.x = e.pageX
|
345
|
+
start.y = e.pageY
|
346
|
+
|
347
|
+
|
348
|
+
// console.log("t", this.$slots.default[0].elm.style);
|
349
|
+
|
350
|
+
})
|
351
|
+
this.slot.addEventListener("mousedown", (e) => {
|
352
|
+
|
353
|
+
console.log("mousedown", e);
|
354
|
+
this.active = true
|
355
|
+
|
356
|
+
e.stopPropagation();
|
357
|
+
start.x = e.pageX;
|
358
|
+
start.y = e.pageY;
|
359
|
+
})
|
360
|
+
this.slot.addEventListener("mouseleave", (e) => {
|
361
|
+
|
362
|
+
console.log("mouseleave", e);
|
363
|
+
// this.active = false
|
364
|
+
})
|
365
|
+
this.slot.addEventListener("mouseup", (e) => {
|
366
|
+
|
367
|
+
console.log("mouseleave", e);
|
368
|
+
this.active = false
|
369
|
+
})
|
370
|
+
|
371
|
+
// console.log("父元素", this.$slots.default[0].elm);
|
372
|
+
|
373
|
+
this.left = this.x;
|
374
|
+
this.top = this.y;
|
375
|
+
this.right = this.parentWidth - (this.w === 'auto' ? (this.$refs.container as HTMLElement).scrollWidth : this.w) - this.left;
|
376
|
+
this.bottom = this.parentHeight - (this.h === 'auto' ? (this.$refs.container as HTMLElement).scrollHeight : this.h) - this.top;
|
377
|
+
|
378
|
+
// this.domEvents = new Map([
|
379
|
+
// ['mousemove', this.move],
|
380
|
+
// ['mouseup', this.up],
|
381
|
+
// ['mouseleave', this.up],
|
382
|
+
// ['mousedown', this.deselect],
|
383
|
+
// ['touchmove', this.move],
|
384
|
+
// ['touchend', this.up],
|
385
|
+
// ['touchcancel', this.up],
|
386
|
+
// ['touchstart', this.up],
|
387
|
+
// ]);
|
388
|
+
|
389
|
+
// addEvents(this.domEvents);
|
390
|
+
|
391
|
+
if (this.dragHandle) {
|
392
|
+
[...this.$el.querySelectorAll(this.dragHandle)].forEach((dragHandle) => {
|
393
|
+
dragHandle.setAttribute('data-drag-handle', this._uid);
|
394
|
+
});
|
395
|
+
}
|
396
|
+
|
397
|
+
if (this.dragCancel) {
|
398
|
+
[...this.$el.querySelectorAll(this.dragCancel)].forEach((cancelHandle) => {
|
399
|
+
cancelHandle.setAttribute('data-drag-cancel', this._uid);
|
400
|
+
});
|
401
|
+
}
|
402
|
+
|
403
|
+
if (this.name.trim() !== '' && this.isStorage) {
|
404
|
+
let info = JSON.parse(localStorage.getItem("DragResizeView_Rect_" + this.name) as string)
|
405
|
+
if (info !== null
|
406
|
+
&& info.left !== null && info.top !== null
|
407
|
+
&& info.right !== null && info.bottom !== null) {
|
408
|
+
this.left = info.left
|
409
|
+
this.top = info.top
|
410
|
+
this.right = info.right
|
411
|
+
this.bottom = info.bottom
|
412
|
+
} else {
|
413
|
+
localStorage.removeItem("DragResizeView_Rect_" + this.name)
|
414
|
+
}
|
415
|
+
}
|
416
|
+
}
|
417
|
+
|
418
|
+
}
|
419
|
+
</script>
|
420
|
+
|
421
|
+
<style lang="less" scoped>
|
422
|
+
@import "index.less";
|
423
|
+
</style>
|
@@ -10,15 +10,15 @@
|
|
10
10
|
|
11
11
|
<div class="list" id="list">
|
12
12
|
|
13
|
-
<
|
13
|
+
<DragResizeViewTs v-for="(rect, index) in rects" :key="index" :isStorage="true" :name="rect.name" :w="rect.width" :h="rect.height"
|
14
14
|
:x="rect.left" :y="rect.top" :parentW="listWidth" :parentH="listHeight" :axis="rect.axis"
|
15
15
|
:isActive="rect.active" :minw="rect.minw" :minh="rect.minh" :isDraggable="rect.draggable"
|
16
16
|
:isResizable="rect.resizable" :parentLimitation="rect.parentLim" :snapToGrid="rect.snapToGrid"
|
17
17
|
:aspectRatio="rect.aspectRatio" :z="rect.zIndex" :contentClass="rect.class" v-on:activated="activateEv(index)"
|
18
18
|
v-on:deactivated="deactivateEv(index)" v-on:dragging="changePosition($event, index)"
|
19
19
|
v-on:resizing="changeSize($event, index)">
|
20
|
-
<div class="filler" :style="{ backgroundColor: rect.color }"
|
21
|
-
</
|
20
|
+
<div class="filler" :style="{ backgroundColor: rect.color }">dsdsfd</div>
|
21
|
+
</DragResizeViewTs>
|
22
22
|
|
23
23
|
</div>
|
24
24
|
|
@@ -29,7 +29,8 @@
|
|
29
29
|
<script lang="ts">
|
30
30
|
import { Component, Vue } from "vue-property-decorator";
|
31
31
|
import ImageViewer from "@/views/ImageViewer/index.vue";
|
32
|
-
import
|
32
|
+
import DragResizeViewTs from "@/views/DragResizeViewTs/index.vue";
|
33
|
+
// import DragResizeViewTs from "@/views/DragResizeView/index.vue";
|
33
34
|
|
34
35
|
import { formatJson, export_json_to_excel, number_to_excel, testToExcel } from "./Export2Excel"
|
35
36
|
|
@@ -40,7 +41,7 @@ import LAY_EXCEL from 'lay-excel';
|
|
40
41
|
@Component({
|
41
42
|
components: {
|
42
43
|
ImageViewer,
|
43
|
-
|
44
|
+
DragResizeViewTs
|
44
45
|
},
|
45
46
|
mounted() {
|
46
47
|
|
package/tsconfig.json
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
"sourceMap": true, // 是否生成sourceMap(用于浏览器调试)
|
6
6
|
"noImplicitAny": false,
|
7
7
|
"noUnusedLocals": false,
|
8
|
-
"noUnusedParameters":
|
8
|
+
"noUnusedParameters": false,
|
9
9
|
"declaration": true, // 是否生成声明文件
|
10
10
|
"declarationDir": "./dist/types/", // 声明文件打包的位置
|
11
11
|
"declarationMap": false, // 是否生成声明文件map文件(便于调试)
|
12
12
|
"moduleResolution": "node",
|
13
|
-
"module": "
|
14
|
-
"target": "
|
13
|
+
"module": "es6",
|
14
|
+
"target": "es6", // 转化成的目标语言
|
15
15
|
"baseUrl": "./",
|
16
16
|
"strict": true,
|
17
17
|
"jsx": "preserve",
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"esModuleInterop": true,
|
21
21
|
"allowSyntheticDefaultImports": true,
|
22
22
|
"forceConsistentCasingInFileNames": true,
|
23
|
-
"useDefineForClassFields": true,
|
23
|
+
"useDefineForClassFields": true,
|
24
24
|
"types": [
|
25
25
|
"node",
|
26
26
|
"webpack-env",
|
package/webpack.config.js
CHANGED
@@ -35,6 +35,7 @@ const config = {
|
|
35
35
|
open: true,
|
36
36
|
host: "localhost",
|
37
37
|
},
|
38
|
+
optimization: { sideEffects: true },
|
38
39
|
externals: {
|
39
40
|
'./cptable': 'var cptable'
|
40
41
|
},
|
@@ -76,7 +77,8 @@ const config = {
|
|
76
77
|
},
|
77
78
|
{
|
78
79
|
test: /\.less$/i,
|
79
|
-
use: [
|
80
|
+
use: ['style-loader', 'css-loader', 'less-loader'],
|
81
|
+
// use: [stylesHandler, "css-loader", "postcss-loader", "less-loader"], // 会丢失样式
|
80
82
|
},
|
81
83
|
{
|
82
84
|
test: /\.css$/i,
|