优化
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<view class="px-3 absolute top-0 left-0 z-10">
|
<view class="px-3 absolute top-0 left-0 z-10">
|
||||||
<cl-text
|
<cl-text
|
||||||
:style="{
|
:style="{
|
||||||
fontSize: px2rpx(14) * size + 'rpx'
|
fontSize: 28 * size + 'rpx'
|
||||||
}"
|
}"
|
||||||
>{{ t("这是一段示例文字,用于预览不同字号的效果。") }}</cl-text
|
>{{ t("这是一段示例文字,用于预览不同字号的效果。") }}</cl-text
|
||||||
>
|
>
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { px2rpx } from "@/cool";
|
|
||||||
import { t } from "@/locale";
|
import { t } from "@/locale";
|
||||||
import { type ClSelectOption } from "@/uni_modules/cool-ui";
|
import { type ClSelectOption } from "@/uni_modules/cool-ui";
|
||||||
import { config } from "@/uni_modules/cool-ui/config";
|
import { config } from "@/uni_modules/cool-ui/config";
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ class Size {
|
|||||||
"text-9xl"
|
"text-9xl"
|
||||||
];
|
];
|
||||||
|
|
||||||
// 对应的字号大小(px)
|
// 对应的字号大小
|
||||||
public sizes = [10, 12, 14, 16, 18, 22, 28, 34, 46, 58, 70, 94, 126];
|
public sizes = [20, 24, 28, 32, 36, 44, 52, 60, 72, 84, 96, 120, 152];
|
||||||
|
|
||||||
// 对应的行高(px)
|
// 对应的行高
|
||||||
public lineHeights = [14, 18, 22, 26, 26, 1, 1, 1, 1, 1, 1, 1, 1];
|
public lineHeights = [28, 36, 44, 52, 52, 1, 1, 1, 1, 1, 1, 1, 1];
|
||||||
|
|
||||||
// 原始类名
|
// 原始类名
|
||||||
public className: ComputedRef<string> = computed(() => "");
|
public className: ComputedRef<string> = computed(() => "");
|
||||||
@@ -104,7 +104,7 @@ class Size {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getRpx(size ?? px2rpx(this.sizes[this.getIndex()]));
|
return this.getRpx(size ?? this.sizes[this.getIndex()]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +117,7 @@ class Size {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const lineHeight = this.lineHeights[this.getIndex()];
|
const lineHeight = this.lineHeights[this.getIndex()];
|
||||||
return lineHeight == 1 ? `1` : this.getRpx(px2rpx(lineHeight));
|
return lineHeight == 1 ? `1` : this.getRpx(lineHeight);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user