@didaoktv/didaoui-uniapp 2.15.0 → 2.16.0

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.
@@ -21,11 +21,11 @@
21
21
  :style="{ width: 100 / columns + '%' }"
22
22
  @click="onSelect(item, i)"
23
23
  >
24
- <view class="dd-action-sheet__icon">
25
- <dd-icon v-if="item.icon" :name="item.icon" class="dd-action-sheet__icon-text" />
26
- <text v-else class="dd-action-sheet__icon-text">{{ item.name.charAt(0) }}</text>
24
+ <view class="dd-action-sheet__icon" :style="iconStyle(item)">
25
+ <dd-icon v-if="item.icon" :name="item.icon" class="dd-action-sheet__icon-text" :color="iconFg(item)" />
26
+ <text v-else class="dd-action-sheet__icon-text" :style="{ color: iconFg(item) }">{{ item.name.charAt(0) }}</text>
27
27
  </view>
28
- <text class="dd-action-sheet__name">{{ item.name }}</text>
28
+ <text class="dd-action-sheet__name" :style="item.color ? { color: item.color } : undefined">{{ item.name }}</text>
29
29
  </view>
30
30
  </view>
31
31
 
@@ -48,6 +48,8 @@ interface ActionItem {
48
48
  name: string
49
49
  icon?: string
50
50
  color?: string
51
+ /** 圆底上图标/首字的颜色;默认白。color 为浅色(金/黄等)时必须传深色,否则白字看不清 */
52
+ iconColor?: string
51
53
  }
52
54
 
53
55
  interface Props {
@@ -81,6 +83,21 @@ function close() {
81
83
  emit('close')
82
84
  }
83
85
 
86
+ /**
87
+ * 图标圆底配色:默认沿用品牌金渐变 + gold glow;item.color 指定时改用该色实心底
88
+ * ponytail: ceiling — color 项放弃 gold glow(glow 变量按语义名静态拼装,无法从任意色值推导),
89
+ * 视觉上仍是实心圆 + 白色图标,足够辨识;若后续需要彩色 glow,改在 item 上传 glow 变体名
90
+ */
91
+ function iconStyle(item: ActionItem): Record<string, string> | undefined {
92
+ return item.color ? { background: item.color } : undefined
93
+ }
94
+
95
+ /** 圆底上的图标/首字颜色:仅在自定义底色时接管(默认白),否则返回 undefined 保持原有继承行为 */
96
+ function iconFg(item: ActionItem): string | undefined {
97
+ if (!item.color && !item.iconColor) return undefined
98
+ return item.iconColor ?? '#ffffff'
99
+ }
100
+
84
101
  function onMaskClick() {
85
102
  if (!props.closeOnClickModal) return
86
103
  close()
@@ -113,7 +113,7 @@ function onClick(e: Event) {
113
113
  }
114
114
 
115
115
  &__body {
116
- padding: $dd-space-5;
116
+ padding: $dd-space-4 $dd-space-5;
117
117
  box-sizing: border-box;
118
118
  }
119
119
 
@@ -139,7 +139,7 @@ function onClick(e: Event) {
139
139
  }
140
140
  }
141
141
 
142
- // horizontal: 去除 header/footer 分隔线, body flex
142
+ // horizontal: 行内排布;收窄相邻区块内侧间距,消除双倍缝隙(外缘与区块间均 32rpx)
143
143
  .dd-card--horizontal {
144
144
  display: flex;
145
145
  flex-direction: row;
@@ -152,15 +152,20 @@ function onClick(e: Event) {
152
152
  }
153
153
  }
154
154
 
155
+ .dd-card__header {
156
+ flex-shrink: 0;
157
+ padding: $dd-space-4 $dd-space-2 $dd-space-4 $dd-space-4;
158
+ }
159
+
155
160
  .dd-card__body {
156
161
  flex: 1;
157
- padding: $dd-space-4;
162
+ min-width: 0;
163
+ padding: $dd-space-4 $dd-space-2;
158
164
  }
159
165
 
160
- // horizontal 不堆叠 header/footer, 整体作为 row
161
- .dd-card__header,
162
166
  .dd-card__footer {
163
- padding: $dd-space-4;
167
+ flex-shrink: 0;
168
+ padding: $dd-space-4 $dd-space-4 $dd-space-4 $dd-space-2;
164
169
  }
165
170
  }
166
171
 
@@ -191,8 +196,4 @@ function onClick(e: Event) {
191
196
  }
192
197
  }
193
198
  }
194
-
195
- .dd-card--horizontal.dd-card--active {
196
- border: 2px solid var(--dd-primary, #{$dd-primary});
197
- }
198
199
  </style>
@@ -61,8 +61,9 @@ onMounted(() => {
61
61
  // H5: 使用原生 IntersectionObserver API
62
62
  function setupH5Observer() {
63
63
  // #ifdef H5
64
- const el = rootRef.value
65
- if (!el) return
64
+ // uni H5 模板 ref 拿到的是组件实例包装,真实 DOM 节点在 $el 上
65
+ const el = (rootRef.value as any)?.$el ?? rootRef.value
66
+ if (!(el instanceof Element)) return
66
67
  const px = rpxToPx(props.offsetTop)
67
68
  const io = new IntersectionObserver(
68
69
  (entries) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didaoktv/didaoui-uniapp",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "帝到KTV UniApp 组件库",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",