@didaoktv/didaoui-uniapp 1.3.3 → 1.3.4

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.
@@ -42,6 +42,8 @@ interface Props {
42
42
  title?: string
43
43
  loading?: boolean
44
44
  readonly?: boolean
45
+ // 每次打开时各列定位到的索引(缺省/超界则回落到当前值或 0),用于回显已有选中项(如房型筛选当前值)
46
+ defaultIndexes?: number[]
45
47
  }
46
48
 
47
49
  const props = withDefaults(defineProps<Props>(), {
@@ -50,6 +52,7 @@ const props = withDefaults(defineProps<Props>(), {
50
52
  title: '',
51
53
  loading: false,
52
54
  readonly: false,
55
+ defaultIndexes: () => [],
53
56
  })
54
57
 
55
58
  const emit = defineEmits<{
@@ -77,6 +80,21 @@ watch(
77
80
  { immediate: true }
78
81
  )
79
82
 
83
+ // 打开时按 defaultIndexes 回显各列索引;非法值(超界/非数字)回落当前值或 0
84
+ watch(
85
+ () => props.show,
86
+ (v) => {
87
+ if (!v) return
88
+ const cols = normalizedColumns.value
89
+ const d = props.defaultIndexes
90
+ indexes.value = cols.map((_, i) => {
91
+ const preset = d[i]
92
+ if (typeof preset !== 'number' || preset < 0) return indexes.value[i] ?? 0
93
+ return Math.min(preset, Math.max(0, (cols[i]?.length || 1) - 1))
94
+ })
95
+ }
96
+ )
97
+
80
98
  function emitChange() {
81
99
  const items = normalizedColumns.value.map((col, i) => col[indexes.value[i] ?? 0] || { text: '', value: null })
82
100
  return {
@@ -116,6 +134,11 @@ function onConfirm() {
116
134
  background-image: linear-gradient(180deg, var(--dd-surface-container, #{$dd-surface-container}), transparent 60%),
117
135
  linear-gradient(0deg, var(--dd-surface-container, #{$dd-surface-container}), transparent 60%);
118
136
  }
137
+ // ponytail: H5 picker-view 吸附 itemSize 取 indicator 框高度(默认34px),必须与行高一致拖动松手才对齐。
138
+ // 需与下方 .dd-picker__item 的 88rpx 保持一致;改行高时必须同步改这里。小程序为原生组件此规则天然无效,安全。
139
+ :deep(.uni-picker-view-indicator) {
140
+ height: 88rpx;
141
+ }
119
142
  .dd-picker {
120
143
  &__mask {
121
144
  position: fixed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didaoktv/didaoui-uniapp",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "帝到KTV UniApp 组件库",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",