From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 uview-ui/libs/function/type2icon.js |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/uview-ui/libs/function/type2icon.js b/uview-ui/libs/function/type2icon.js
new file mode 100644
index 0000000..23cb40e
--- /dev/null
+++ b/uview-ui/libs/function/type2icon.js
@@ -0,0 +1,35 @@
+/**
+ * 鏍规嵁涓婚type鍊�,鑾峰彇瀵瑰簲鐨勫浘鏍�
+ * @param String type 涓婚鍚嶇О,primary|info|error|warning|success
+ * @param String fill 鏄惁浣跨敤fill濉厖瀹炰綋鐨勫浘鏍�  
+ */
+function type2icon(type = 'success', fill = false) {
+	// 濡傛灉闈為缃��,榛樿涓簊uccess
+	if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
+	let iconName = '';
+	// 鐩墠(2019-12-12),info鍜宲rimary浣跨敤鍚屼竴涓浘鏍�
+	switch (type) {
+		case 'primary':
+			iconName = 'info-circle';
+			break;
+		case 'info':
+			iconName = 'info-circle';
+			break;
+		case 'error':
+			iconName = 'close-circle';
+			break;
+		case 'warning':
+			iconName = 'error-circle';
+			break;
+		case 'success':
+			iconName = 'checkmark-circle';
+			break;
+		default:
+			iconName = 'checkmark-circle';
+	}
+	// 鏄惁鏄疄浣撶被鍨�,鍔犱笂-fill,鍦╥con缁勪欢搴撲腑,瀹炰綋鐨勭被鍚嶆槸鍚庨潰鍔�-fill鐨�
+	if (fill) iconName += '-fill';
+	return iconName;
+}
+
+export default type2icon

--
Gitblit v1.9.3