Просмотр исходного кода

解决打包后 cl-icon 颜色异常问题

icssoa 5 месяцев назад
Родитель
Сommit
2917c2251b
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      uni_modules/cool-ui/components/cl-icon/cl-icon.uvue

+ 12 - 2
uni_modules/cool-ui/components/cl-icon/cl-icon.uvue

@@ -6,7 +6,17 @@
 
 <script setup lang="ts">
 import { computed, type PropType } from "vue";
-import { forInObject, get, has, parsePt, useCache, isDark, ctx, hasTextColor } from "@/cool";
+import {
+	forInObject,
+	get,
+	has,
+	parsePt,
+	useCache,
+	isDark,
+	ctx,
+	hasTextColor,
+	isNull
+} from "@/cool";
 import { icons } from "@/icons";
 import { useSize } from "../../hooks";
 
@@ -97,7 +107,7 @@ const icon = computed<Icon>(() => {
 
 // 图标颜色
 const color = computed(() => {
-	if (props.color != "") {
+	if (props.color != "" && !isNull(props.color)) {
 		switch (props.color) {
 			case "primary":
 				return ctx.color["primary-500"] as string;