优化 cl-text 组件的字体大小和颜色,在 pt 配置中无需添加 ! 符号

This commit is contained in:
icssoa
2025-09-07 11:08:01 +08:00
parent 8e583121e4
commit 1b6fc90d59
57 changed files with 406 additions and 239 deletions

View File

@@ -9,22 +9,42 @@
<view class="flex flex-row justify-between">
<view class="flex flex-col items-center justify-center">
<cl-image :src="url" mode="aspectFill"></cl-image>
<cl-text class="!text-sm mt-1">aspectFill</cl-text>
<cl-text
:pt="{
className: 'text-sm mt-1'
}"
>aspectFill</cl-text
>
</view>
<view class="flex flex-col items-center justify-center">
<cl-image :src="url" mode="aspectFit"></cl-image>
<cl-text class="!text-sm mt-1">aspectFit</cl-text>
<cl-text
:pt="{
className: 'text-sm mt-1'
}"
>aspectFit</cl-text
>
</view>
<view class="flex flex-col items-center justify-center">
<cl-image :src="url" mode="heightFix"></cl-image>
<cl-text class="!text-sm mt-1">heightFix</cl-text>
<cl-text
:pt="{
className: 'text-sm mt-1'
}"
>heightFix</cl-text
>
</view>
<view class="flex flex-col items-center justify-center">
<cl-image :src="url" mode="scaleToFill"></cl-image>
<cl-text class="!text-sm mt-1">scaleToFill</cl-text>
<cl-text
:pt="{
className: 'text-sm mt-1'
}"
>scaleToFill</cl-text
>
</view>
</view>
</demo-item>

View File

@@ -6,7 +6,17 @@
</demo-item>
<demo-item :label="t('自定义颜色')">
<cl-text color="primary">云想衣裳花想容,春风拂槛露华浓。</cl-text>
<cl-text color="primary">明月松间照,清泉石上流。</cl-text>
<cl-text color="error">举头望明月,低头思故乡。</cl-text>
<cl-text color="success">春眠不觉晓,处处闻啼鸟。</cl-text>
<cl-text color="warn">劝君更尽一杯酒,西出阳关无故人。</cl-text>
<cl-text color="info">孤帆远影碧空尽,唯见长江天际流。</cl-text>
<cl-text
:pt="{
className: 'text-sky-500'
}"
>大漠孤烟直,长河落日圆。</cl-text
>
</demo-item>
<demo-item :label="t('手机号脱敏')">

View File

@@ -1,6 +1,6 @@
<template>
<view class="demo-item dark:!bg-surface-800">
<cl-text :pt="{ className: '!text-sm !text-surface-400 mb-2' }" v-if="label != ''">{{
<cl-text :pt="{ className: 'text-sm text-surface-400 mb-2' }" v-if="label != ''">{{
label
}}</cl-text>

View File

@@ -2,7 +2,7 @@
<view class="bg-surface-100 dark:!bg-surface-700 rounded-lg p-3 mb-3">
<cl-text
:pt="{
className: '!text-sm'
className: 'text-sm'
}"
>
<slot></slot>

View File

@@ -43,13 +43,13 @@
</demo-item>
<demo-item>
<cl-text pre-wrap :pt="{ className: '!text-sm p-2' }">{{
<cl-text pre-wrap :pt="{ className: 'text-sm p-2' }">{{
JSON.stringify(filterForm, null, 4)
}}</cl-text>
</demo-item>
<demo-item>
<cl-text pre-wrap :pt="{ className: '!text-sm p-2' }">{{
<cl-text pre-wrap :pt="{ className: 'text-sm p-2' }">{{
JSON.stringify(searchForm, null, 4)
}}</cl-text>
</demo-item>
@@ -84,7 +84,7 @@
]
]),
label: {
className: '!text-sm'
className: 'text-sm'
}
}"
></cl-checkbox>
@@ -147,7 +147,7 @@
]
]),
label: {
className: '!text-sm'
className: 'text-sm'
}
}"
></cl-checkbox>
@@ -177,7 +177,7 @@
]
]),
label: {
className: '!text-sm'
className: 'text-sm'
}
}"
></cl-radio>
@@ -207,7 +207,7 @@
]
]),
label: {
className: '!text-sm'
className: 'text-sm'
}
}"
></cl-radio>

View File

@@ -8,7 +8,15 @@
</demo-item>
<demo-item :label="t('内容靠左')">
<cl-list-item :label="t('QQ')" justify="start">
<cl-list-item
:label="t('QQ')"
justify="start"
:pt="{
label: {
className: '!w-10'
}
}"
>
<cl-text>615206459</cl-text>
</cl-list-item>
</demo-item>
@@ -25,6 +33,21 @@
</cl-list-item>
</demo-item>
<demo-item :label="t('带图片')">
<cl-list-item
arrow
:pt="{
image: {
width: 48,
height: 48
}
}"
:label="t('神仙都没用')"
image="https://unix.cool-js.com/images/demo/avatar.jpg"
>
</cl-list-item>
</demo-item>
<demo-item :label="t('折叠')">
<cl-list-item :label="t('点击展开')" collapse arrow>
<template #collapse>

View File

@@ -38,7 +38,7 @@
<template #prev>
<cl-text
:pt="{
className: '!text-sm'
className: 'text-sm'
}"
>{{ t("上一页") }}</cl-text
>
@@ -47,7 +47,7 @@
<template #next>
<cl-text
:pt="{
className: '!text-sm'
className: 'text-sm'
}"
>{{ t("下一页") }}</cl-text
>

View File

@@ -49,7 +49,7 @@
<view class="flex-1 px-3">
<cl-text>{{ t("优选灵活配置混合A") }}</cl-text>
<cl-text class="mr-5 mt-1 !text-sm">{{ t("1000元起") }}</cl-text>
<cl-text class="mr-5 mt-1 text-sm">{{ t("1000元起") }}</cl-text>
<view class="flex flex-row mt-2 items-center">
<cl-button size="small" type="light">{{

View File

@@ -43,7 +43,7 @@
<cl-text
v-if="halfCheckedKeys.length > 0"
:pt="{
className: '!text-sm p-2'
className: 'text-sm p-2'
}"
>{{ halfCheckedKeys.join("、") }}</cl-text
>
@@ -65,7 +65,7 @@
<cl-text
v-if="expandedKeys.length > 0"
:pt="{
className: '!text-sm p-2'
className: 'text-sm p-2'
}"
>{{ expandedKeys.join("、") }}</cl-text
>

View File

@@ -27,7 +27,7 @@
<cl-row class="mt-2" :pt="{ className: 'justify-end items-center' }">
<cl-icon name="heart-line"></cl-icon>
<cl-text :pt="{ className: '!text-sm ml-1' }">{{
<cl-text :pt="{ className: 'text-sm ml-1' }">{{
item["likeCount"]
}}</cl-text>
</cl-row>

View File

@@ -57,7 +57,7 @@
<template #item="{ item }">
<view class="flex flex-col justify-center items-center">
<cl-icon :name="item.icon" :size="46"></cl-icon>
<cl-text :pt="{ className: '!text-sm mt-1' }">{{ item.label }}</cl-text>
<cl-text :pt="{ className: 'text-sm mt-1' }">{{ item.label }}</cl-text>
</view>
</template>
</cl-action-sheet>

View File

@@ -77,7 +77,23 @@
{
'!bg-surface-700': isDark && isCustom
}
])
]),
icon: {
className: parseClass([
[
isCustom && checked3.includes(item.value as string),
'text-red-500'
]
])
},
label: {
className: parseClass([
[
isCustom && checked3.includes(item.value as string),
'text-red-500'
]
])
}
}"
>
{{ item.label }}

View File

@@ -141,7 +141,7 @@
</demo-item>
<demo-item>
<cl-text pre-wrap :pt="{ className: '!text-sm p-2' }">{{
<cl-text pre-wrap :pt="{ className: 'text-sm p-2' }">{{
JSON.stringify(formData, null, 4)
}}</cl-text>
</demo-item>

View File

@@ -66,7 +66,17 @@
{
'!bg-surface-700': isDark && isCustom
}
])
]),
icon: {
className: parseClass([
[isCustom && item.value == checked3, 'text-red-500']
])
},
label: {
className: parseClass([
[isCustom && item.value == checked3, 'text-red-500']
])
}
}"
>
{{ item.label }}

View File

@@ -53,7 +53,7 @@
<cl-text
:pt="{
className:
'mb-3 !text-sm p-3 bg-surface-100 dark:!bg-surface-700 rounded-lg'
'mb-3 text-sm p-3 bg-surface-100 dark:!bg-surface-700 rounded-lg'
}"
v-if="form.selected4 != null && isShowValue"
>
@@ -120,7 +120,7 @@ type Form = {
};
const form = reactive<Form>({
selected: 1,
selected: null,
selected2: "2",
selected3: [],
selected4: 3

View File

@@ -19,7 +19,7 @@
}),
inner: {
className: parseClass({
'!text-sky-700': isColor
'text-sky-700': isColor
})
}
}"