muzhiyu-ui 1.0.2 → 1.0.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.
|
@@ -161,7 +161,6 @@ const computedIconSize = computed(() => {
|
|
|
161
161
|
|
|
162
162
|
const defaultIconColor = computed(() => {
|
|
163
163
|
if (props.iconColor) return props.iconColor
|
|
164
|
-
if (props.color) return props.color
|
|
165
164
|
if (props.plain) {
|
|
166
165
|
switch (props.type) {
|
|
167
166
|
case 'primary': return config?.primaryColor?.value || '#171717'
|
|
@@ -171,6 +170,11 @@ const defaultIconColor = computed(() => {
|
|
|
171
170
|
default: return '#64748B'
|
|
172
171
|
}
|
|
173
172
|
}
|
|
173
|
+
// 实色按钮 (primary, danger, success, warning) 图标默认必须为纯白
|
|
174
|
+
if (props.type === 'primary' || props.type === 'danger' || props.type === 'success' || props.type === 'warning') {
|
|
175
|
+
return '#ffffff'
|
|
176
|
+
}
|
|
177
|
+
if (props.color) return props.color
|
|
174
178
|
if (props.type === 'default' || props.type === 'text' || props.type === 'link') return '#475569'
|
|
175
179
|
return '#ffffff'
|
|
176
180
|
})
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="mu-icon" :style="iconWrapStyle" @tap="handleClick">
|
|
3
|
-
<!--
|
|
3
|
+
<!-- 图片模式与 SVG DataURI 矢量模式(100% 兼容微信小程序) -->
|
|
4
4
|
<image
|
|
5
|
-
v-if="isImageUrl"
|
|
5
|
+
v-if="isImageUrl || svgDataUri"
|
|
6
6
|
class="mu-icon__image"
|
|
7
|
-
:src="imageUrl"
|
|
7
|
+
:src="isImageUrl ? imageUrl : svgDataUri"
|
|
8
8
|
:style="imageSizeStyle"
|
|
9
9
|
mode="aspectFit"
|
|
10
10
|
/>
|
|
11
|
-
<!-- 内联 SVG 矢量图标 - 100% 极速精准渲染 -->
|
|
12
|
-
<view
|
|
13
|
-
v-else-if="svgInnerHtml"
|
|
14
|
-
class="mu-icon__svg-wrap"
|
|
15
|
-
:style="imageSizeStyle"
|
|
16
|
-
v-html="svgInnerHtml"
|
|
17
|
-
></view>
|
|
18
11
|
<!-- 回退文本 -->
|
|
19
12
|
<text v-else class="mu-icon__fallback" :style="textStyle">{{ name }}</text>
|
|
20
13
|
</view>
|
|
@@ -723,19 +716,19 @@ const isImageUrl = computed(() => {
|
|
|
723
716
|
)
|
|
724
717
|
})
|
|
725
718
|
|
|
726
|
-
const
|
|
719
|
+
const svgDataUri = computed(() => {
|
|
727
720
|
if (isImageUrl.value) return ''
|
|
728
721
|
const key = props.name ? props.name.toLowerCase() : 'info'
|
|
729
722
|
const targetKey = aliasMap[key] || key
|
|
730
723
|
const path = rawSvgPaths[targetKey] || rawSvgPaths['info']
|
|
731
724
|
if (!path) return ''
|
|
732
|
-
|
|
733
|
-
|
|
725
|
+
// 替换 # 为 %23 以兼容微信小程序 SVG DataURI 编码
|
|
726
|
+
let colorVal = (!props.color || props.color === 'currentColor') ? '%23ffffff' : props.color.replace(/#/g, '%23')
|
|
734
727
|
const isFill = ['star', 'heart'].includes(targetKey)
|
|
735
728
|
const fillAttr = isFill ? colorVal : 'none'
|
|
736
729
|
const strokeAttr = isFill ? 'none' : colorVal
|
|
737
|
-
|
|
738
|
-
return
|
|
730
|
+
const svgString = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="${fillAttr}" stroke="${strokeAttr}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${path}</svg>`
|
|
731
|
+
return `data:image/svg+xml;utf8,${svgString}`
|
|
739
732
|
})
|
|
740
733
|
|
|
741
734
|
const iconWrapStyle = computed(() => ({
|
package/index.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* @version 1.0.0
|
|
6
6
|
*/
|
|
7
7
|
import http from './utils/request.js'
|
|
8
|
-
import { util, validate,
|
|
8
|
+
import { util, validate, validator, color } from './utils/index.js'
|
|
9
|
+
const format = util // 别名挂载
|
|
9
10
|
|
|
10
11
|
// Toast 快捷 JS 弹窗函数
|
|
11
12
|
const toast = (title, type, options = {}) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muzhiyu-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "基于 UniApp Vue3 + SCSS 打造的全端极奢组件库",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"uni_modules": {
|
|
30
30
|
"id": "muzhiyu-ui",
|
|
31
31
|
"name": "muzhiyu-ui 极奢组件库",
|
|
32
|
-
"version": "1.0.
|
|
32
|
+
"version": "1.0.4",
|
|
33
33
|
"description": "基于 UniApp Vue3 + SCSS 打造的全端极奢 UI 组件库",
|
|
34
34
|
"site": "",
|
|
35
35
|
"displayName": "MuzhiyuUI 极奢全端组件库"
|
package/utils/index.js
CHANGED
|
@@ -529,6 +529,8 @@ util.notify.close = () => uni.$emit('mu-notify-close')
|
|
|
529
529
|
util.loadingPage.hide = () => uni.$emit('mu-loading-page-hide')
|
|
530
530
|
util.loadingPage.close = () => uni.$emit('mu-loading-page-hide')
|
|
531
531
|
|
|
532
|
+
export const format = util
|
|
533
|
+
|
|
532
534
|
/**
|
|
533
535
|
* 全局统一导出核心入口对象 (mu)
|
|
534
536
|
*/
|