@tplc/wot 1.0.25 → 1.0.27
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/CHANGELOG.md +14 -0
- package/components/wd-img/wd-img.vue +1 -1
- package/components/wd-tab/wd-tab.vue +1 -1
- package/components/wd-tabs/types.ts +4 -4
- package/components/wd-tabs/wd-tabs.vue +64 -23
- package/package.json +1 -1
- package/types/components/wd-tabs/types.d.ts +4 -4
- package/types/components/wd-tabs/wd-tabs.vue.d.ts +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.27](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.26...v1.0.27) (2026-01-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ♻️ Code Refactoring | 代码重构
|
|
9
|
+
|
|
10
|
+
* **wd-tabs:** change font size and weight props to accept both numeric and string types ([169a4e5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/169a4e56bb7d81e675bd9a2cfaded0e2a06272d8))
|
|
11
|
+
|
|
12
|
+
### [1.0.26](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.63...v1.0.26) (2026-01-11)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### ♻️ Code Refactoring | 代码重构
|
|
16
|
+
|
|
17
|
+
* **lcb-video:** update video component styles and extend props for dynamic sizing ([56757fa](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/56757fa5b437bff60015c0f9d7c05d7959d19927))
|
|
18
|
+
|
|
5
19
|
### [1.0.25](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.53...v1.0.25) (2026-01-07)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -41,7 +41,7 @@ const painted = ref<boolean>(active.value) // 初始状态tab不会渲染,必
|
|
|
41
41
|
|
|
42
42
|
const tabBodyStyle = computed(() => {
|
|
43
43
|
const style: CSSProperties = {}
|
|
44
|
-
if (!active.value && (!isDef(tabs) || !(tabs as any).props
|
|
44
|
+
if (!active.value && (!isDef(tabs) || !(tabs as any).props?.animated)) {
|
|
45
45
|
style.display = 'none'
|
|
46
46
|
}
|
|
47
47
|
return objToStyle(style)
|
|
@@ -71,20 +71,20 @@ export const tabsProps = {
|
|
|
71
71
|
/**
|
|
72
72
|
* 字体大小
|
|
73
73
|
*/
|
|
74
|
-
itemFontSize:
|
|
74
|
+
itemFontSize: makeNumericProp(28),
|
|
75
75
|
/**
|
|
76
76
|
* 字体粗细
|
|
77
77
|
*/
|
|
78
|
-
itemFontWeight:
|
|
78
|
+
itemFontWeight: makeNumericProp('normal'),
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* 活动状态字体粗细
|
|
82
82
|
*/
|
|
83
|
-
activeFontWeight:
|
|
83
|
+
activeFontWeight: makeNumericProp('normal'),
|
|
84
84
|
/**
|
|
85
85
|
* 活动状态字体大小
|
|
86
86
|
*/
|
|
87
|
-
activeFontSize:
|
|
87
|
+
activeFontSize: makeNumericProp(28),
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export type TabsProps = ExtractPropTypes<typeof tabsProps>
|
|
@@ -227,6 +227,37 @@ const state = reactive({
|
|
|
227
227
|
scrollLeft: 0, // scroll-view偏移量
|
|
228
228
|
})
|
|
229
229
|
|
|
230
|
+
const wait = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms))
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 小程序端首次渲染时,createSelectorQuery/boundingClientRect 可能拿到 0 宽度,
|
|
234
|
+
* 导致下划线/滚动定位初始化不准。这里做一次有限重试,确保布局稳定后再计算。
|
|
235
|
+
*/
|
|
236
|
+
async function getNavLayoutWithRetry(retry: number = 6) {
|
|
237
|
+
for (let i = 0; i < retry; i++) {
|
|
238
|
+
try {
|
|
239
|
+
const [navItemsRects, navRect] = await Promise.all([
|
|
240
|
+
getRect($item, true, proxy),
|
|
241
|
+
getRect($container, false, proxy),
|
|
242
|
+
])
|
|
243
|
+
const selectItem = (navItemsRects as any)?.[state.activeIndex]
|
|
244
|
+
if (
|
|
245
|
+
selectItem &&
|
|
246
|
+
Number(selectItem.width) > 0 &&
|
|
247
|
+
navRect &&
|
|
248
|
+
Number((navRect as any).width) > 0
|
|
249
|
+
) {
|
|
250
|
+
return [navItemsRects, navRect]
|
|
251
|
+
}
|
|
252
|
+
} catch (e) {
|
|
253
|
+
// ignore and retry
|
|
254
|
+
}
|
|
255
|
+
await nextTick()
|
|
256
|
+
await wait(30)
|
|
257
|
+
}
|
|
258
|
+
return await Promise.all([getRect($item, true, proxy), getRect($container, false, proxy)])
|
|
259
|
+
}
|
|
260
|
+
|
|
230
261
|
// map的开关
|
|
231
262
|
|
|
232
263
|
const { children, linkChildren } = useChildren(TABS_KEY)
|
|
@@ -374,26 +405,34 @@ function toggleMap() {
|
|
|
374
405
|
function updateLineStyle(animation: boolean = true) {
|
|
375
406
|
if (!state.inited) return
|
|
376
407
|
const { lineWidth, lineHeight } = props
|
|
377
|
-
|
|
378
|
-
|
|
408
|
+
getNavLayoutWithRetry()
|
|
409
|
+
.then(([rects]) => {
|
|
410
|
+
const lineStyle: CSSProperties = {}
|
|
379
411
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
412
|
+
if (isDef(lineWidth)) {
|
|
413
|
+
lineStyle.width = addUnit(lineWidth)
|
|
414
|
+
}
|
|
415
|
+
if (isDef(lineHeight)) {
|
|
416
|
+
lineStyle.height = addUnit(lineHeight)
|
|
417
|
+
lineStyle.borderRadius = `calc(${addUnit(lineHeight)} / 2)`
|
|
418
|
+
}
|
|
419
|
+
const rect = (rects as any)?.[state.activeIndex]
|
|
420
|
+
if (!rect || Number(rect.width) <= 0) return
|
|
421
|
+
|
|
422
|
+
const left =
|
|
423
|
+
(rects as any)
|
|
424
|
+
.slice(0, state.activeIndex)
|
|
425
|
+
.reduce((prev: number, curr: any) => prev + Number(curr.width), 0) +
|
|
426
|
+
Number(rect.width) / 2
|
|
427
|
+
lineStyle.transform = `translateX(${left}px) translateX(-50%)`
|
|
428
|
+
if (animation) {
|
|
429
|
+
lineStyle.transition = 'width 300ms ease, transform 300ms ease'
|
|
430
|
+
}
|
|
431
|
+
state.lineStyle = objToStyle(lineStyle)
|
|
432
|
+
})
|
|
433
|
+
.catch(() => {
|
|
434
|
+
// ignore measure failure
|
|
435
|
+
})
|
|
397
436
|
}
|
|
398
437
|
/**
|
|
399
438
|
* @description 通过控制tab的active来展示选定的tab
|
|
@@ -413,8 +452,8 @@ function setActiveTab() {
|
|
|
413
452
|
*/
|
|
414
453
|
function scrollIntoView() {
|
|
415
454
|
if (!state.inited) return
|
|
416
|
-
|
|
417
|
-
([navItemsRects, navRect]) => {
|
|
455
|
+
getNavLayoutWithRetry()
|
|
456
|
+
.then(([navItemsRects, navRect]) => {
|
|
418
457
|
// 选中元素
|
|
419
458
|
const selectItem = navItemsRects[state.activeIndex]
|
|
420
459
|
// 选中元素之前的节点的宽度总和
|
|
@@ -428,8 +467,10 @@ function scrollIntoView() {
|
|
|
428
467
|
} else {
|
|
429
468
|
state.scrollLeft = left
|
|
430
469
|
}
|
|
431
|
-
}
|
|
432
|
-
|
|
470
|
+
})
|
|
471
|
+
.catch(() => {
|
|
472
|
+
// ignore measure failure
|
|
473
|
+
})
|
|
433
474
|
}
|
|
434
475
|
/**
|
|
435
476
|
* @description 单击tab的处理
|
package/package.json
CHANGED
|
@@ -93,28 +93,28 @@ export declare const tabsProps: {
|
|
|
93
93
|
* 字体大小
|
|
94
94
|
*/
|
|
95
95
|
itemFontSize: {
|
|
96
|
-
type:
|
|
96
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
97
97
|
default: number
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* 字体粗细
|
|
101
101
|
*/
|
|
102
102
|
itemFontWeight: {
|
|
103
|
-
type:
|
|
103
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
104
104
|
default: string
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* 活动状态字体粗细
|
|
108
108
|
*/
|
|
109
109
|
activeFontWeight: {
|
|
110
|
-
type:
|
|
110
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
111
111
|
default: string
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* 活动状态字体大小
|
|
115
115
|
*/
|
|
116
116
|
activeFontSize: {
|
|
117
|
-
type:
|
|
117
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
118
118
|
default: number
|
|
119
119
|
}
|
|
120
120
|
customStyle: {
|
|
@@ -48,19 +48,19 @@ declare const _default: __VLS_WithTemplateSlots<
|
|
|
48
48
|
default: import('./types').TagsMode
|
|
49
49
|
}
|
|
50
50
|
itemFontSize: {
|
|
51
|
-
type:
|
|
51
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
52
52
|
default: number
|
|
53
53
|
}
|
|
54
54
|
itemFontWeight: {
|
|
55
|
-
type:
|
|
55
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
56
56
|
default: string
|
|
57
57
|
}
|
|
58
58
|
activeFontWeight: {
|
|
59
|
-
type:
|
|
59
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
60
60
|
default: string
|
|
61
61
|
}
|
|
62
62
|
activeFontSize: {
|
|
63
|
-
type:
|
|
63
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
64
64
|
default: number
|
|
65
65
|
}
|
|
66
66
|
customStyle: {
|
|
@@ -139,19 +139,19 @@ declare const _default: __VLS_WithTemplateSlots<
|
|
|
139
139
|
default: import('./types').TagsMode
|
|
140
140
|
}
|
|
141
141
|
itemFontSize: {
|
|
142
|
-
type:
|
|
142
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
143
143
|
default: number
|
|
144
144
|
}
|
|
145
145
|
itemFontWeight: {
|
|
146
|
-
type:
|
|
146
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
147
147
|
default: string
|
|
148
148
|
}
|
|
149
149
|
activeFontWeight: {
|
|
150
|
-
type:
|
|
150
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
151
151
|
default: string
|
|
152
152
|
}
|
|
153
153
|
activeFontSize: {
|
|
154
|
-
type:
|
|
154
|
+
type: (NumberConstructor | StringConstructor)[]
|
|
155
155
|
default: number
|
|
156
156
|
}
|
|
157
157
|
customStyle: {
|
|
@@ -183,10 +183,10 @@ declare const _default: __VLS_WithTemplateSlots<
|
|
|
183
183
|
mapNum: number
|
|
184
184
|
swipeable: boolean
|
|
185
185
|
animated: boolean
|
|
186
|
-
itemFontSize: number
|
|
187
|
-
itemFontWeight: string
|
|
188
|
-
activeFontWeight: string
|
|
189
|
-
activeFontSize: number
|
|
186
|
+
itemFontSize: string | number
|
|
187
|
+
itemFontWeight: string | number
|
|
188
|
+
activeFontWeight: string | number
|
|
189
|
+
activeFontSize: string | number
|
|
190
190
|
},
|
|
191
191
|
{}
|
|
192
192
|
>,
|