riku
2024-08-14 f2a0ea849099f49a3d2a9c7e5c44d033df22468f
miniprogram_npm/tdesign-miniprogram/grid/README.md
@@ -19,6 +19,12 @@
## 代码演示
<a href="https://developers.weixin.qq.com/s/6H70dimL7jSK" title="在开发者工具中预览效果" target="_blank" rel="noopener noreferrer"> 在开发者工具中预览效果 </a>
<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" >
<p>Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p>
</blockquote>
### 组件类型
基础宫格
@@ -63,10 +69,15 @@
align | String | center | 内容对齐方式。可选项:left/center | N
border | Boolean / Object | false | 边框,默认不显示。值为 true 则显示默认边框,值类型为 object 则表示自定义边框样式。TS 类型:`boolean \| { color?: string; width?: string; style?: 'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'groove' \| 'inset' \| 'outset' }` | N
column | Number | 4 | 每一行的列数量;为 0 时等于固定大小 | N
external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class']` | N
gutter | Number | - | 间隔大小 | N
hover | Boolean | false | 是否开启点击反馈 | N
theme | String | default | 宫格的风格。可选项:default/card | N
### Grid 外部样式类
类名 | 说明
-- | --
t-class | 根节点样式类
### GridItem Props
@@ -74,7 +85,6 @@
-- | -- | -- | -- | --
badge-props | Object | null | 透传至 Badge 属性。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/grid-item/type.ts) | N
description | String / Slot | - | 文本以外的更多描述,辅助信息。可以通过 Props 传入文本,也可以自定义标题节点 | N
external-classes | Array | - | 组件类名,分别用于设置组件外层元素、图片、文本、描述等元素类名。`['t-class', 't-class-image', 't-class-text', 't-class-description']` | N
icon | String / Object | - | 图标名称。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon` | N
image | String / Slot | - | 图片,可以是图片地址,也可以自定义图片节点,值为 slot 的时候才能使用插槽 | N
image-props | Object | - | 透传至 Image 组件 | N
@@ -89,3 +99,37 @@
-- | -- | --
click | \- | 点击子项后触发
### GridItem 外部样式类
类名 | 说明
-- | --
t-class | 根节点样式类
t-class-content | 内容样式类
t-class-image | 图片样式类
t-class-text | 文本样式类
t-class-description | 描述样式类
### CSS 变量
组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-grid-bg-color | @bg-color-container | -
--td-grid-card-radius | @radius-large | -
--td-grid-item-bg-color | @bg-color-container | -
--td-grid-item-description-color | @font-gray-3 | -
--td-grid-item-description-font-size | 24rpx | -
--td-grid-item-description-line-height | 40rpx | -
--td-grid-item-description-padding-top | 8rpx | -
--td-grid-item-horizontal-text-description-top | 4rpx | -
--td-grid-item-horizontal-text-padding-left | 24rpx | -
--td-grid-item-hover-bg-color | @bg-color-secondarycontainer | -
--td-grid-item-image-middle-width | 80rpx | -
--td-grid-item-image-small-width | 64rpx | -
--td-grid-item-image-width | 96rpx | -
--td-grid-item-padding | 32rpx | -
--td-grid-item-text-color | @font-gray-1 | -
--td-grid-item-text-font-size | 28rpx | -
--td-grid-item-text-line-height | 44rpx | -
--td-grid-item-text-middle-font-size | 24rpx | -
--td-grid-item-text-padding-top | 16rpx | -
--td-grid-item-text-small-font-size | 24rpx | -