Ver código fonte

优化字体大小

icssoa 6 meses atrás
pai
commit
62d8638b70

+ 14 - 4
uni_modules/cool-ui/components/cl-calendar/cl-calendar.uvue

@@ -115,10 +115,11 @@
 
 <script lang="ts" setup>
 import { computed, nextTick, onMounted, ref, watch, type PropType } from "vue";
-import { ctx, dayUts, first, isDark, isEmpty, isHarmony, parsePt, useRefs } from "@/cool";
+import { ctx, dayUts, first, isDark, isHarmony, parsePt, useRefs } from "@/cool";
 import CalendarPicker from "./picker.uvue";
 import { $t, t } from "@/locale";
 import type { ClCalendarDateConfig, ClCalendarMode } from "../../types";
+import { useSize } from "../../hooks";
 
 defineOptions({
 	name: "cl-calendar"
@@ -202,6 +203,9 @@ type PassThrough = {
 // 解析透传样式配置
 const pt = computed(() => parsePt<PassThrough>(props.pt));
 
+// 字体大小
+const { getPxValue } = useSize();
+
 // 主色
 const color = ref(ctx.color["primary-500"] as string);
 // 单元格高度
@@ -209,7 +213,15 @@ const cellHeight = ref(66);
 // 单元格间距
 const cellGap = ref(0);
 // 字体大小
-const fontSize = ref(14);
+const fontSize = computed(() => {
+	// #ifdef APP
+	return getPxValue("14px");
+	// #endif
+
+	// #ifndef APP
+	return 14;
+	// #endif
+});
 // 当前月份日期颜色
 const textColor = computed(() => {
 	return isDark.value ? "white" : (ctx.color["surface-700"] as string);
@@ -596,8 +608,6 @@ function onYearMonthChange(yearMonthArray: number[]) {
 	currentYear.value = yearMonthArray[0];
 	currentMonth.value = yearMonthArray[1];
 
-	console.log(yearMonthArray);
-
 	// 重新计算日历数据并重绘
 	calculateDateMatrix();
 	renderCalendar();