diff --git a/packages/vant/docs/markdown/changelog-v4.zh-CN.md b/packages/vant/docs/markdown/changelog-v4.zh-CN.md index 38f934031..0c2d97be0 100644 --- a/packages/vant/docs/markdown/changelog-v4.zh-CN.md +++ b/packages/vant/docs/markdown/changelog-v4.zh-CN.md @@ -41,6 +41,7 @@ - Button: 默认圆角大小从 `2px` 调整为 `4px` - Button: 默认按钮的边框颜色调整为 `--van-gray-4` - Button: 调整 `font-smoothing`,默认使用粗体文字 +- Cell: 只设置 `value` 时,内容不再会靠左对齐 - Card: 调整 `--van-card-background` 变量的默认值为 `--van-background` - Card: 调整 `--van-card-price-color` 变量的默认值为 `--van-text-color` - Card: 调整 `--van-card-desc-color` 变量的默认值为 `--van-text-color-2` diff --git a/packages/vant/src/cell/Cell.tsx b/packages/vant/src/cell/Cell.tsx index df06603e3..fbbd94e88 100644 --- a/packages/vant/src/cell/Cell.tsx +++ b/packages/vant/src/cell/Cell.tsx @@ -93,9 +93,8 @@ export default defineComponent({ const hasValue = slot || isDef(props.value); if (hasValue) { - const hasTitle = slots.title || isDef(props.title); return ( -
+
{slot ? slot() : {props.value}}
); diff --git a/packages/vant/src/cell/demo/index.vue b/packages/vant/src/cell/demo/index.vue index 3763121fc..ea44bf4db 100644 --- a/packages/vant/src/cell/demo/index.vue +++ b/packages/vant/src/cell/demo/index.vue @@ -16,7 +16,6 @@ const t = useTranslate({ showIcon: '展示图标', showArrow: '展示箭头', largeSize: '单元格大小', - valueOnly: '只设置 value', groupTitle: '分组标题', insetGrouped: '卡片风格', verticalCenter: '垂直居中', @@ -31,7 +30,6 @@ const t = useTranslate({ showIcon: 'Left Icon', showArrow: 'Link', largeSize: 'Size', - valueOnly: 'Value only', groupTitle: 'Group Title', insetGrouped: 'Inset Grouped', verticalCenter: 'Vertical center', @@ -68,10 +66,6 @@ const t = useTranslate({ - - - - diff --git a/packages/vant/src/cell/index.less b/packages/vant/src/cell/index.less index 0b7f379aa..7a2d48c79 100644 --- a/packages/vant/src/cell/index.less +++ b/packages/vant/src/cell/index.less @@ -62,11 +62,6 @@ body { text-align: right; vertical-align: middle; word-wrap: break-word; - - &--alone { - color: var(--van-text-color); - text-align: left; - } } &__left-icon, diff --git a/packages/vant/src/cell/test/__snapshots__/demo.spec.ts.snap b/packages/vant/src/cell/test/__snapshots__/demo.spec.ts.snap index cdc102fde..fb5995d79 100644 --- a/packages/vant/src/cell/test/__snapshots__/demo.spec.ts.snap +++ b/packages/vant/src/cell/test/__snapshots__/demo.spec.ts.snap @@ -108,15 +108,6 @@ exports[`should render demo and match snapshot 1`] = `
-
-
-
- - Content - -
-
-
-
+
Custom Value