From cdd98aa6f0bcc3ce8b6ae600e6e26d9d695d5ad0 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Tue, 21 Jan 2025 15:46:24 +0800 Subject: [PATCH] fix(Cell): fix component style errors --- src/cell-group/props.ts | 7 +--- src/cell-group/type.ts | 18 +-------- src/cell/README.en-US.md | 21 +++++++++- src/cell/README.md | 23 ++++++++++- .../__test__/__snapshots__/demo.test.js.snap | 10 ++--- .../__test__/__snapshots__/index.test.js.snap | 4 +- src/cell/_example/base/index.wxml | 2 +- src/cell/_example/multiple/index.wxml | 8 ++-- src/cell/cell.less | 39 +++++++++++-------- src/cell/cell.wxml | 4 +- src/cell/props.ts | 2 +- src/cell/type.ts | 2 +- .../__test__/__snapshots__/index.test.js.snap | 8 ++-- 13 files changed, 88 insertions(+), 60 deletions(-) diff --git a/src/cell-group/props.ts b/src/cell-group/props.ts index f66589cb2..67de5b738 100644 --- a/src/cell-group/props.ts +++ b/src/cell-group/props.ts @@ -9,12 +9,9 @@ const props: TdCellGroupProps = { /** 是否显示组边框 */ bordered: { type: Boolean, + value: false, }, - /** 组件类名 */ - externalClasses: { - type: Array, - }, - /** 单元格风格 */ + /** 单元格组风格 */ theme: { type: String, value: 'default', diff --git a/src/cell-group/type.ts b/src/cell-group/type.ts index fb8f899f7..657fe4ee7 100644 --- a/src/cell-group/type.ts +++ b/src/cell-group/type.ts @@ -7,28 +7,14 @@ export interface TdCellGroupProps { /** * 是否显示组边框 + * @default false */ bordered?: { type: BooleanConstructor; value?: boolean; }; /** - * 自定义组件样式 - * @default '' - */ - style?: { - type: StringConstructor; - value?: string; - }; - /** - * 组件类名 - */ - externalClasses?: { - type: ArrayConstructor; - value?: ['t-class']; - }; - /** - * 单元格风格 + * 单元格组风格 * @default default */ theme?: { diff --git a/src/cell/README.en-US.md b/src/cell/README.en-US.md index afadd5e43..b905035ab 100644 --- a/src/cell/README.en-US.md +++ b/src/cell/README.en-US.md @@ -27,6 +27,7 @@ url | String | - | \- | N name | params | description -- | -- | -- click | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) + ### Cell External Classes className | Description @@ -43,6 +44,24 @@ t-class-right | \- t-class-right-icon | \- t-class-title | \- + +### CellGroup Props + +name | type | default | description | required +-- | -- | -- | -- | -- +style | Object | - | CSS(Cascading Style Sheets) | N +custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N +bordered | Boolean | false | \- | N +theme | String | default | options: default/card | N +title | String | - | \- | N + +### CellGroup External Classes + +className | Description +-- | -- +t-class | \- +t-class-title | \- + ### CSS Variables The component provides the following CSS variables, which can be used to customize styles. @@ -78,4 +97,4 @@ Name | Default Value | Description --td-cell-right-icon-font-size | 48rpx | - --td-cell-title-color | @text-color-primary | - --td-cell-title-font-size | @font-size-m | - ---td-cell-vertical-padding | 32rpx | - +--td-cell-vertical-padding | 32rpx | - \ No newline at end of file diff --git a/src/cell/README.md b/src/cell/README.md index a018b4138..6e50a2369 100644 --- a/src/cell/README.md +++ b/src/cell/README.md @@ -53,7 +53,7 @@ isComponent: true -- | -- | -- | -- | -- style | Object | - | 样式 | N custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N -align | String | middle | 内容的对齐方式,默认居中对齐。可选项:top/middle/bottom | N +align | String | middle | 右侧内容的对齐方式,默认居中对齐。可选项:top/middle/bottom | N arrow | Boolean / Object | false | 是否显示右侧箭头 | N bordered | Boolean | true | 是否显示下边框 | N description | String / Slot | - | 下方内容描述。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N @@ -72,6 +72,7 @@ url | String | - | 点击后跳转链接地址。如果值为空,则表示不 名称 | 参数 | 描述 -- | -- | -- click | - | 右侧内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) + ### Cell External Classes 类名 | 描述 @@ -88,6 +89,24 @@ t-class-right | 右侧内容样式类 t-class-right-icon | 右侧图标样式类 t-class-title | 标题样式类 + +### CellGroup Props + +名称 | 类型 | 默认值 | 描述 | 必传 +-- | -- | -- | -- | -- +style | Object | - | 样式 | N +custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N +bordered | Boolean | false | 是否显示组边框 | N +theme | String | default | 单元格组风格。可选项:default/card | N +title | String | - | 单元格组标题 | N + +### CellGroup External Classes + +类名 | 描述 +-- | -- +t-class | 根节点样式类 +t-class-title | 标题样式类 + ### CSS Variables 组件提供了下列 CSS 变量,可用于自定义样式。 @@ -123,4 +142,4 @@ t-class-title | 标题样式类 --td-cell-right-icon-font-size | 48rpx | - --td-cell-title-color | @text-color-primary | - --td-cell-title-font-size | @font-size-m | - ---td-cell-vertical-padding | 32rpx | - +--td-cell-vertical-padding | 32rpx | - \ No newline at end of file diff --git a/src/cell/__test__/__snapshots__/demo.test.js.snap b/src/cell/__test__/__snapshots__/demo.test.js.snap index 1d56669fd..9f6cd9655 100644 --- a/src/cell/__test__/__snapshots__/demo.test.js.snap +++ b/src/cell/__test__/__snapshots__/demo.test.js.snap @@ -43,7 +43,7 @@ exports[`Cell Cell base demo works fine 1`] = ` arrow="{{true}}" bordered="{{false}}" hover="{{true}}" - leftIcon="lock-on" + leftIcon="app" title="单行标题" /> @@ -96,19 +96,19 @@ exports[`Cell Cell multiple demo works fine 1`] = ` arrow="{{true}}" description="一段很长很长的内容文字" hover="{{true}}" - leftIcon="lock-on" + leftIcon="app" title="单行标题" /> `; diff --git a/src/cell/__test__/__snapshots__/index.test.js.snap b/src/cell/__test__/__snapshots__/index.test.js.snap index a94231709..db19bea12 100644 --- a/src/cell/__test__/__snapshots__/index.test.js.snap +++ b/src/cell/__test__/__snapshots__/index.test.js.snap @@ -8,7 +8,7 @@ exports[`cell :base 1`] = ` diff --git a/src/cell/_example/base/index.wxml b/src/cell/_example/base/index.wxml index 9e4b31688..8df4092bc 100644 --- a/src/cell/_example/base/index.wxml +++ b/src/cell/_example/base/index.wxml @@ -7,4 +7,4 @@ - + diff --git a/src/cell/_example/multiple/index.wxml b/src/cell/_example/multiple/index.wxml index 6ac55f111..1f3fde167 100644 --- a/src/cell/_example/multiple/index.wxml +++ b/src/cell/_example/multiple/index.wxml @@ -7,15 +7,15 @@ - - - + + + - +