@atooyu/uxto-ui 1.1.0 → 1.1.2

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/style.css CHANGED
@@ -321,25 +321,25 @@ to {
321
321
  .u-modal__button--confirm[data-v-9552a05f] {
322
322
  color: #00a29a;
323
323
  font-weight: 500;
324
- }.u-icon[data-v-5d845d48] {
324
+ }.u-icon[data-v-632e7780] {
325
325
  display: inline-flex;
326
326
  align-items: center;
327
327
  justify-content: center;
328
328
  font-style: normal;
329
329
  line-height: 1;
330
330
  }
331
- .u-icon--spin[data-v-5d845d48] {
332
- animation: u-icon-spin-5d845d48 1s linear infinite;
331
+ .u-icon--spin[data-v-632e7780] {
332
+ animation: u-icon-spin-632e7780 1s linear infinite;
333
333
  }
334
- .u-icon__inner[data-v-5d845d48] {
334
+ .u-icon__inner[data-v-632e7780] {
335
335
  font-family: inherit;
336
336
  line-height: 1;
337
337
  }
338
- .u-icon__svg[data-v-5d845d48] {
338
+ .u-icon__svg[data-v-632e7780] {
339
339
  display: block;
340
340
  object-fit: contain;
341
341
  }
342
- @keyframes u-icon-spin-5d845d48 {
342
+ @keyframes u-icon-spin-632e7780 {
343
343
  from {
344
344
  transform: rotate(0deg);
345
345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atooyu/uxto-ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "跨平台 UI 组件库 - 支持 Android、iOS、鸿蒙",
5
5
  "keywords": [
6
6
  "uxto-ui",
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
+ <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
+ <path d="M3 11h8V3H3v8zm2-6h4v4H5V5zm8-2v8h8V3h-8zm6 6h-4V5h4v4zM3 21h8v-8H3v8zm2-6h4v4H5v-4zm13-2h-2v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/>
3
+ </svg>
@@ -85,6 +85,8 @@ import bookmark from './icons/bookmark.svg'
85
85
  import bookmarkO from './icons/bookmark-o.svg'
86
86
  import chat from './icons/chat.svg'
87
87
  import clipboard from './icons/clipboard.svg'
88
+ import location from './icons/location.svg'
89
+ import scan from './icons/scan.svg'
88
90
 
89
91
  // 图标映射表
90
92
  export const icons: Record<string, string> = {
@@ -208,6 +210,10 @@ export const icons: Record<string, string> = {
208
210
  'clock': clock,
209
211
  'time': clock,
210
212
  'calendar': clock,
213
+
214
+ // 位置和扫码
215
+ 'location': location,
216
+ 'scan': scan,
211
217
  }
212
218
 
213
219
  // 获取图标 SVG 内容
@@ -10,7 +10,7 @@
10
10
  v-if="isSvgIcon && iconSrc"
11
11
  class="u-icon__svg"
12
12
  :src="iconSrc"
13
- :style="{ width: sizePx, height: sizePx }"
13
+ :style="svgStyle"
14
14
  mode="aspectFit"
15
15
  />
16
16
  <!-- Emoji/文字模式 -->
@@ -48,7 +48,33 @@ const isSvgIcon = computed(() => {
48
48
 
49
49
  // 获取图标 SVG 资源
50
50
  const iconSrc = computed(() => {
51
- return getIcon(props.name)
51
+ const svgData = getIcon(props.name)
52
+ if (!svgData) return ''
53
+
54
+ // 如果指定了颜色,替换 SVG 中的 fill 颜色
55
+ if (props.color && svgData.startsWith('data:image/svg+xml')) {
56
+ try {
57
+ // 解码 SVG 内容
58
+ let svgContent = decodeURIComponent(svgData.replace('data:image/svg+xml,', ''))
59
+
60
+ // 替换 currentColor 或添加 fill 属性
61
+ if (svgContent.includes('fill="currentColor"')) {
62
+ svgContent = svgContent.replace(/fill="currentColor"/g, `fill="${props.color}"`)
63
+ } else if (!svgContent.includes('fill=')) {
64
+ svgContent = svgContent.replace('<svg', `<svg fill="${props.color}"`)
65
+ } else {
66
+ // 替换已有的 fill 颜色
67
+ svgContent = svgContent.replace(/fill="[^"]*"/g, `fill="${props.color}"`)
68
+ }
69
+
70
+ // 重新编码
71
+ return 'data:image/svg+xml,' + encodeURIComponent(svgContent)
72
+ } catch (e) {
73
+ return svgData
74
+ }
75
+ }
76
+
77
+ return svgData
52
78
  })
53
79
 
54
80
  // 尺寸转换为 px
@@ -65,13 +91,20 @@ const iconStyle = computed(() => {
65
91
  width: size + 'px',
66
92
  height: size + 'px'
67
93
  }
68
- // SVG 图标通过 fill="currentColor" 支持颜色
69
- // 但 image 标签不支持直接设置颜色,需要通过 filter 或特殊处理
94
+ // SVG 图标设置颜色
70
95
  if (props.color && !isSvgIcon.value) {
71
96
  style.color = props.color
72
97
  }
73
98
  return style
74
99
  })
100
+
101
+ // SVG 图标样式
102
+ const svgStyle = computed(() => {
103
+ return {
104
+ width: sizePx.value,
105
+ height: sizePx.value
106
+ }
107
+ })
75
108
  </script>
76
109
 
77
110
  <script lang="ts">
@@ -114,4 +147,4 @@ export default {
114
147
  transform: rotate(360deg);
115
148
  }
116
149
  }
117
- </style>
150
+ </style>