adtec-core-package 2.2.2 → 2.2.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adtec-core-package",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"vue-focus-lock": "^3.0.0",
|
|
41
41
|
"vue-img-viewr": "2.0.11",
|
|
42
42
|
"vue-router": "^4.5.0",
|
|
43
|
-
"vxe-pc-ui": "4.6.8",
|
|
44
43
|
"vxe-table": "4.13.28",
|
|
45
44
|
"wujie-vue3": "^1.0.24",
|
|
46
45
|
"xlsx-js-style": "^1.2.0"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import VxeTooltipComponent from './src/tooltip'
|
|
2
|
+
|
|
3
|
+
export const VxeTooltip = Object.assign({}, VxeTooltipComponent, {
|
|
4
|
+
install (app: import("vue").App) {
|
|
5
|
+
app.component(VxeTooltipComponent.name as string, VxeTooltipComponent)
|
|
6
|
+
}
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const Tooltip = VxeTooltip
|
|
11
|
+
export default VxeTooltip
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
//@ts-ignore
|
|
2
|
+
import {
|
|
3
|
+
h,
|
|
4
|
+
ref,
|
|
5
|
+
nextTick,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
onMounted,
|
|
8
|
+
computed,
|
|
9
|
+
reactive,
|
|
10
|
+
watch,
|
|
11
|
+
type PropType,
|
|
12
|
+
type VNode
|
|
13
|
+
} from 'vue'
|
|
14
|
+
|
|
15
|
+
// 定义属性类型
|
|
16
|
+
interface VxeTooltipPropTypes {
|
|
17
|
+
modelValue?: boolean
|
|
18
|
+
content?: string | number
|
|
19
|
+
trigger?: 'hover' | 'click'
|
|
20
|
+
theme?: 'dark' | 'light'
|
|
21
|
+
enterDelay?: number
|
|
22
|
+
leaveDelay?: number
|
|
23
|
+
isArrow?: boolean
|
|
24
|
+
enterable?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 定义响应式数据类型
|
|
28
|
+
interface TooltipReactData {
|
|
29
|
+
target: HTMLElement | null
|
|
30
|
+
isUpdate: boolean
|
|
31
|
+
visible: boolean
|
|
32
|
+
tipContent: string | number
|
|
33
|
+
tipActive: boolean
|
|
34
|
+
tipTarget: HTMLElement | null
|
|
35
|
+
tipZindex: number
|
|
36
|
+
tipStore: {
|
|
37
|
+
style: Record<string, string | number>
|
|
38
|
+
placement: string
|
|
39
|
+
arrowStyle: Record<string, string | number> | null
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 定义内部数据类型
|
|
44
|
+
interface TooltipInternalData {
|
|
45
|
+
showDelayTip?: Function
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 定义组件方法类型
|
|
49
|
+
interface TooltipMethods {
|
|
50
|
+
open: (target?: HTMLElement | null, content?: string | number) => void
|
|
51
|
+
close: () => void
|
|
52
|
+
updatePlacement: () => Promise<void>
|
|
53
|
+
isActived: () => boolean
|
|
54
|
+
setActived: (active: boolean) => void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 简单的防抖函数
|
|
58
|
+
function debounce(func: Function, wait: number) {
|
|
59
|
+
let timeout: number | null = null
|
|
60
|
+
return function (this: any, ...args: any[]) {
|
|
61
|
+
if (timeout) {
|
|
62
|
+
clearTimeout(timeout)
|
|
63
|
+
}
|
|
64
|
+
timeout = window.setTimeout(() => {
|
|
65
|
+
func.apply(this, args)
|
|
66
|
+
}, wait) as any
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 检查值是否为空
|
|
71
|
+
function isNull(value: any): boolean {
|
|
72
|
+
return value === null || value === undefined
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 检查值是否相等
|
|
76
|
+
function eqNull(value: any): boolean {
|
|
77
|
+
return value === null || value === undefined || value === ''
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: 'VxeTooltip',
|
|
82
|
+
props: {
|
|
83
|
+
modelValue: Boolean,
|
|
84
|
+
content: [String, Number],
|
|
85
|
+
trigger: {
|
|
86
|
+
type: String as PropType<'hover' | 'click'>,
|
|
87
|
+
default: 'hover'
|
|
88
|
+
},
|
|
89
|
+
theme: {
|
|
90
|
+
type: String as PropType<'dark' | 'light'>,
|
|
91
|
+
default: 'dark'
|
|
92
|
+
},
|
|
93
|
+
isArrow: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: true
|
|
96
|
+
},
|
|
97
|
+
enterable: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
101
|
+
enterDelay: {
|
|
102
|
+
type: Number,
|
|
103
|
+
default: 0
|
|
104
|
+
},
|
|
105
|
+
leaveDelay: {
|
|
106
|
+
type: Number,
|
|
107
|
+
default: 0
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
emits: ['update:modelValue'],
|
|
111
|
+
setup(props: VxeTooltipPropTypes, { slots, emit }: any) {
|
|
112
|
+
// 响应式数据
|
|
113
|
+
const reactData = reactive<TooltipReactData>({
|
|
114
|
+
target: null,
|
|
115
|
+
isUpdate: false,
|
|
116
|
+
visible: false,
|
|
117
|
+
tipContent: '',
|
|
118
|
+
tipActive: false,
|
|
119
|
+
tipTarget: null,
|
|
120
|
+
tipZindex: 0,
|
|
121
|
+
tipStore: {
|
|
122
|
+
style: {},
|
|
123
|
+
placement: '',
|
|
124
|
+
arrowStyle: {}
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
// 内部数据
|
|
129
|
+
const internalData: TooltipInternalData = {}
|
|
130
|
+
|
|
131
|
+
// DOM 引用
|
|
132
|
+
const refElem = ref<HTMLDivElement>()
|
|
133
|
+
const contentWrapperfElem = ref<HTMLDivElement>()
|
|
134
|
+
|
|
135
|
+
// 获取 DOM 位置信息
|
|
136
|
+
const getDomNode = () => {
|
|
137
|
+
return {
|
|
138
|
+
scrollTop: window.scrollY || document.documentElement.scrollTop,
|
|
139
|
+
scrollLeft: window.scrollX || document.documentElement.scrollLeft,
|
|
140
|
+
visibleWidth: document.documentElement.clientWidth
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 获取元素绝对位置
|
|
145
|
+
const getAbsolutePos = (element: HTMLElement) => {
|
|
146
|
+
const rect = element.getBoundingClientRect()
|
|
147
|
+
return {
|
|
148
|
+
top: rect.top + getDomNode().scrollTop,
|
|
149
|
+
left: rect.left + getDomNode().scrollLeft
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// 更新提示框位置
|
|
154
|
+
const updateTipStyle = () => {
|
|
155
|
+
const { tipTarget, tipStore } = reactData
|
|
156
|
+
if (tipTarget) {
|
|
157
|
+
const { scrollTop, scrollLeft, visibleWidth } = getDomNode()
|
|
158
|
+
const { top, left } = getAbsolutePos(tipTarget)
|
|
159
|
+
const el = refElem.value
|
|
160
|
+
if (!el) return
|
|
161
|
+
|
|
162
|
+
const marginSize = 6
|
|
163
|
+
const offsetHeight = el.offsetHeight
|
|
164
|
+
const offsetWidth = el.offsetWidth
|
|
165
|
+
|
|
166
|
+
let tipLeft = left
|
|
167
|
+
let tipTop = top - offsetHeight - marginSize
|
|
168
|
+
|
|
169
|
+
// 水平居中
|
|
170
|
+
tipLeft = Math.max(
|
|
171
|
+
marginSize,
|
|
172
|
+
left + Math.floor((tipTarget.offsetWidth - offsetWidth) / 2)
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
// 检查是否超出右边界
|
|
176
|
+
if (tipLeft + offsetWidth + marginSize > scrollLeft + visibleWidth) {
|
|
177
|
+
tipLeft = scrollLeft + visibleWidth - offsetWidth - marginSize
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// 检查是否超出上边界,如果超出则显示在底部
|
|
181
|
+
if (top - offsetHeight < scrollTop + marginSize) {
|
|
182
|
+
tipStore.placement = 'bottom'
|
|
183
|
+
tipTop = top + tipTarget.offsetHeight + marginSize
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
tipStore.style.top = `${tipTop}px`
|
|
187
|
+
tipStore.style.left = `${tipLeft}px`
|
|
188
|
+
tipStore.arrowStyle = {
|
|
189
|
+
left: `${left - tipLeft + tipTarget.offsetWidth / 2}px`
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 更新值
|
|
195
|
+
const updateValue = (value: boolean) => {
|
|
196
|
+
if (value !== reactData.visible) {
|
|
197
|
+
reactData.visible = value
|
|
198
|
+
reactData.isUpdate = true
|
|
199
|
+
emit('update:modelValue', value)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 显示提示框
|
|
204
|
+
const showTip = () => {
|
|
205
|
+
const el = refElem.value
|
|
206
|
+
if (el) {
|
|
207
|
+
const parentNode = el.parentNode
|
|
208
|
+
if (!parentNode) {
|
|
209
|
+
document.body.appendChild(el)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
updateValue(true)
|
|
214
|
+
reactData.tipZindex = 1000 // 简化的 z-index
|
|
215
|
+
reactData.tipStore.placement = 'top'
|
|
216
|
+
reactData.tipStore.style = {
|
|
217
|
+
width: 'auto',
|
|
218
|
+
left: 0,
|
|
219
|
+
top: 0,
|
|
220
|
+
zIndex: reactData.tipZindex
|
|
221
|
+
}
|
|
222
|
+
reactData.tipStore.arrowStyle = { left: '50%' }
|
|
223
|
+
|
|
224
|
+
return nextTick().then(() => {
|
|
225
|
+
updateTipStyle()
|
|
226
|
+
return nextTick().then(() => {
|
|
227
|
+
updateTipStyle()
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// 处理延迟函数
|
|
233
|
+
const handleDelayFn = () => {
|
|
234
|
+
internalData.showDelayTip = debounce(() => {
|
|
235
|
+
if (reactData.tipActive) {
|
|
236
|
+
showTip()
|
|
237
|
+
}
|
|
238
|
+
//@ts-ignore
|
|
239
|
+
}, props.enterDelay)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// 处理显示逻辑
|
|
243
|
+
const handleVisible = (target: HTMLElement | null, content?: string | number) => {
|
|
244
|
+
const contentSlot = slots.content
|
|
245
|
+
if (!contentSlot && (content === '' || eqNull(content))) {
|
|
246
|
+
return nextTick()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (target) {
|
|
250
|
+
const { showDelayTip } = internalData
|
|
251
|
+
const { trigger, enterDelay } = props
|
|
252
|
+
reactData.tipActive = true
|
|
253
|
+
reactData.tipTarget = target
|
|
254
|
+
//@ts-ignore
|
|
255
|
+
reactData.tipContent = isNull(content) ? '' : content
|
|
256
|
+
|
|
257
|
+
if (enterDelay && trigger === 'hover') {
|
|
258
|
+
if (showDelayTip) {
|
|
259
|
+
showDelayTip()
|
|
260
|
+
}
|
|
261
|
+
} else {
|
|
262
|
+
return showTip()
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return nextTick()
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 事件处理函数
|
|
269
|
+
const targetMouseenterEvent = () => {
|
|
270
|
+
handleVisible(reactData.target, props.content)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const targetMouseleaveEvent = () => {
|
|
274
|
+
const { trigger, enterable, leaveDelay } = props
|
|
275
|
+
reactData.tipActive = false
|
|
276
|
+
|
|
277
|
+
if (enterable && trigger === 'hover') {
|
|
278
|
+
setTimeout(() => {
|
|
279
|
+
if (!reactData.tipActive) {
|
|
280
|
+
close()
|
|
281
|
+
}
|
|
282
|
+
}, leaveDelay)
|
|
283
|
+
} else {
|
|
284
|
+
close()
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const wrapperMouseenterEvent = () => {
|
|
289
|
+
reactData.tipActive = true
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const wrapperMouseleaveEvent = () => {
|
|
293
|
+
const { trigger, enterable, leaveDelay } = props
|
|
294
|
+
reactData.tipActive = false
|
|
295
|
+
|
|
296
|
+
if (enterable && trigger === 'hover') {
|
|
297
|
+
setTimeout(() => {
|
|
298
|
+
if (!reactData.tipActive) {
|
|
299
|
+
close()
|
|
300
|
+
}
|
|
301
|
+
}, leaveDelay)
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const clickEvent = () => {
|
|
306
|
+
if (reactData.visible) {
|
|
307
|
+
close()
|
|
308
|
+
} else {
|
|
309
|
+
handleVisible(reactData.target, props.content)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 关闭方法
|
|
314
|
+
const close = () => {
|
|
315
|
+
reactData.tipTarget = null
|
|
316
|
+
reactData.tipActive = false
|
|
317
|
+
Object.assign(reactData.tipStore, {
|
|
318
|
+
style: {},
|
|
319
|
+
placement: '',
|
|
320
|
+
arrowStyle: null
|
|
321
|
+
})
|
|
322
|
+
updateValue(false)
|
|
323
|
+
return nextTick()
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 公开方法
|
|
327
|
+
const tooltipMethods: TooltipMethods = {
|
|
328
|
+
open(target?: HTMLElement | null, content?: string | number) {
|
|
329
|
+
return handleVisible(target || reactData.target, content)
|
|
330
|
+
},
|
|
331
|
+
close,
|
|
332
|
+
updatePlacement() {
|
|
333
|
+
return nextTick().then(() => {
|
|
334
|
+
const { tipTarget } = reactData
|
|
335
|
+
const el = refElem.value
|
|
336
|
+
if (tipTarget && el) {
|
|
337
|
+
updateTipStyle()
|
|
338
|
+
return nextTick().then(() => {
|
|
339
|
+
updateTipStyle()
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
},
|
|
344
|
+
isActived() {
|
|
345
|
+
return reactData.tipActive
|
|
346
|
+
},
|
|
347
|
+
setActived(active: boolean) {
|
|
348
|
+
reactData.tipActive = !!active
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// 渲染内容
|
|
353
|
+
const renderContent = () => {
|
|
354
|
+
const { tipContent } = reactData
|
|
355
|
+
const contentSlot = slots.content
|
|
356
|
+
|
|
357
|
+
const contVNs: VNode[] = []
|
|
358
|
+
if (contentSlot) {
|
|
359
|
+
contVNs.push(
|
|
360
|
+
h('div', {}, contentSlot({}))
|
|
361
|
+
)
|
|
362
|
+
} else {
|
|
363
|
+
contVNs.push(
|
|
364
|
+
h('div', {}, `${tipContent}`)
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return h('div', {
|
|
369
|
+
ref: contentWrapperfElem,
|
|
370
|
+
class: 'vxe-tooltip--content'
|
|
371
|
+
}, contVNs)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// 渲染虚拟节点
|
|
375
|
+
const renderVN = () => {
|
|
376
|
+
const { theme, isArrow, enterable } = props
|
|
377
|
+
const { tipActive, visible, tipStore } = reactData
|
|
378
|
+
const defaultSlot = slots.default
|
|
379
|
+
|
|
380
|
+
let ons
|
|
381
|
+
if (enterable) {
|
|
382
|
+
ons = {
|
|
383
|
+
onMouseenter: wrapperMouseenterEvent,
|
|
384
|
+
onMouseleave: wrapperMouseleaveEvent
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return h('div', {
|
|
389
|
+
ref: refElem,
|
|
390
|
+
class: [
|
|
391
|
+
'vxe-tooltip--wrapper',
|
|
392
|
+
`theme--${theme}`,
|
|
393
|
+
{
|
|
394
|
+
[`placement--${tipStore.placement}`]: tipStore.placement,
|
|
395
|
+
'is--enterable': enterable,
|
|
396
|
+
'is--visible': visible,
|
|
397
|
+
'is--arrow': isArrow,
|
|
398
|
+
'is--active': tipActive
|
|
399
|
+
}
|
|
400
|
+
],
|
|
401
|
+
style: {
|
|
402
|
+
...tipStore.style,
|
|
403
|
+
// 添加过渡效果
|
|
404
|
+
transition: 'opacity 0.2s ease, transform 0.2s ease',
|
|
405
|
+
opacity: visible ? 1 : 0,
|
|
406
|
+
transform: visible ? 'scale(1)' : 'scale(0.95)'
|
|
407
|
+
},
|
|
408
|
+
...ons
|
|
409
|
+
}, [
|
|
410
|
+
renderContent(),
|
|
411
|
+
isArrow
|
|
412
|
+
? h('div', {
|
|
413
|
+
class: 'vxe-tooltip--arrow',
|
|
414
|
+
style: tipStore.arrowStyle
|
|
415
|
+
})
|
|
416
|
+
: null,
|
|
417
|
+
...(defaultSlot ? defaultSlot({}) : [])
|
|
418
|
+
])
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// 监听器
|
|
422
|
+
watch(() => props.enterDelay, () => {
|
|
423
|
+
handleDelayFn()
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
watch(() => props.content, (val) => {
|
|
427
|
+
//@ts-ignore
|
|
428
|
+
reactData.tipContent = isNull(val) ? '' : val
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
watch(() => props.modelValue, (val) => {
|
|
432
|
+
if (!reactData.isUpdate) {
|
|
433
|
+
if (val) {
|
|
434
|
+
handleVisible(reactData.target, props.content)
|
|
435
|
+
} else {
|
|
436
|
+
close()
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
reactData.isUpdate = false
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
// 生命周期钩子
|
|
443
|
+
onMounted(() => {
|
|
444
|
+
nextTick(() => {
|
|
445
|
+
const { trigger, content } = props
|
|
446
|
+
const wrapperElem = refElem.value
|
|
447
|
+
|
|
448
|
+
if (wrapperElem) {
|
|
449
|
+
const parentNode = wrapperElem.parentNode
|
|
450
|
+
if (parentNode) {
|
|
451
|
+
//@ts-ignore
|
|
452
|
+
reactData.tipContent = isNull(content) ? '' : content
|
|
453
|
+
reactData.tipZindex = 1000
|
|
454
|
+
|
|
455
|
+
// 将子元素移动到父级
|
|
456
|
+
const children = Array.from(wrapperElem.children)
|
|
457
|
+
children.forEach((elem, index) => {
|
|
458
|
+
if (index > 1) {
|
|
459
|
+
parentNode.insertBefore(elem, wrapperElem)
|
|
460
|
+
if (!reactData.target) {
|
|
461
|
+
reactData.target = elem as HTMLElement
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
parentNode.removeChild(wrapperElem)
|
|
467
|
+
|
|
468
|
+
// 绑定事件
|
|
469
|
+
const { target } = reactData
|
|
470
|
+
if (target) {
|
|
471
|
+
if (trigger === 'hover') {
|
|
472
|
+
target.onmouseenter = targetMouseenterEvent
|
|
473
|
+
target.onmouseleave = targetMouseleaveEvent
|
|
474
|
+
} else if (trigger === 'click') {
|
|
475
|
+
target.onclick = clickEvent
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// 如果 modelValue 为 true,则显示
|
|
480
|
+
if (props.modelValue) {
|
|
481
|
+
handleVisible(target, content)
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
})
|
|
486
|
+
})
|
|
487
|
+
|
|
488
|
+
onBeforeUnmount(() => {
|
|
489
|
+
const { target } = reactData
|
|
490
|
+
const wrapperElem = refElem.value
|
|
491
|
+
|
|
492
|
+
if (target) {
|
|
493
|
+
target.onmouseenter = null
|
|
494
|
+
target.onmouseleave = null
|
|
495
|
+
target.onclick = null
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (wrapperElem) {
|
|
499
|
+
const parentNode = wrapperElem.parentNode
|
|
500
|
+
if (parentNode) {
|
|
501
|
+
parentNode.removeChild(wrapperElem)
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
})
|
|
505
|
+
|
|
506
|
+
handleDelayFn()
|
|
507
|
+
|
|
508
|
+
return {
|
|
509
|
+
...tooltipMethods,
|
|
510
|
+
renderVN
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
//@ts-ignore
|
|
514
|
+
render() {
|
|
515
|
+
//@ts-ignore
|
|
516
|
+
return this.renderVN()
|
|
517
|
+
}
|
|
518
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { VxeGrid } from 'vxe-table'
|
|
2
|
-
|
|
1
|
+
import { VxeGrid,VxeUI } from 'vxe-table'
|
|
2
|
+
//@ts-ignore
|
|
3
|
+
import { VxeTooltip } from '../components/tooltip/index.ts'
|
|
3
4
|
|
|
4
5
|
import VxeUIPluginRenderElement from '@vxe-ui/plugin-render-element'
|
|
5
6
|
import '@vxe-ui/plugin-render-element/dist/style.css'
|
|
@@ -15,15 +16,19 @@ import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
|
|
|
15
16
|
/**
|
|
16
17
|
* 局部初始化 vxe-table 插件与配置
|
|
17
18
|
*/
|
|
18
|
-
export function initVxeTableInPage(
|
|
19
|
+
export function initVxeTableInPage(
|
|
20
|
+
enableExcel: boolean = false,
|
|
21
|
+
enablePdf: boolean = false,
|
|
22
|
+
enableElementPlus: boolean = true,
|
|
23
|
+
) {
|
|
19
24
|
// 设置语言
|
|
20
25
|
VxeUI.setI18n('zh-CN', zhCN)
|
|
21
26
|
VxeUI.setLanguage('zh-CN')
|
|
22
|
-
|
|
27
|
+
VxeUI.component(VxeTooltip)
|
|
23
28
|
// 局部注册插件
|
|
24
|
-
VxeUI.use(VxeUIPluginRenderElement)
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
enableElementPlus && VxeUI.use(VxeUIPluginRenderElement)
|
|
30
|
+
enableExcel && VxeUI.use(VxeUIPluginExportXLSX, { ExcelJS })
|
|
31
|
+
enablePdf && VxeUI.use(VxeUIPluginExportPDF, { jsPDF })
|
|
27
32
|
|
|
28
33
|
// 设置表格配置(可复制你在 VxeTableConfig.ts 中的配置)
|
|
29
34
|
VxeUI.setConfig({
|