@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/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -4
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +6 -6
- package/package.json +1 -1
- package/src/components/u-icon/icons/location.svg +3 -0
- package/src/components/u-icon/icons/scan.svg +3 -0
- package/src/components/u-icon/index.ts +6 -0
- package/src/components/u-icon/u-icon.vue +38 -5
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-
|
|
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-
|
|
332
|
-
animation: u-icon-spin-
|
|
331
|
+
.u-icon--spin[data-v-632e7780] {
|
|
332
|
+
animation: u-icon-spin-632e7780 1s linear infinite;
|
|
333
333
|
}
|
|
334
|
-
.u-icon__inner[data-v-
|
|
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-
|
|
338
|
+
.u-icon__svg[data-v-632e7780] {
|
|
339
339
|
display: block;
|
|
340
340
|
object-fit: contain;
|
|
341
341
|
}
|
|
342
|
-
@keyframes u-icon-spin-
|
|
342
|
+
@keyframes u-icon-spin-632e7780 {
|
|
343
343
|
from {
|
|
344
344
|
transform: rotate(0deg);
|
|
345
345
|
}
|
package/package.json
CHANGED
|
@@ -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="
|
|
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
|
-
|
|
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
|
|
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>
|