Skip to content

Commit

Permalink
docs(Loading): update api docs (#370)
Browse files Browse the repository at this point in the history
* docs(Loading): update api docs

* docs(Loading): update api for miniprogram
  • Loading branch information
anlyyao authored Aug 14, 2024
1 parent 944ec8c commit 5fe022a
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 69 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ loading | Boolean | true | \- | N
pause | Boolean | false | \- | N
progress | Number | - | \- | N
reverse | Boolean | - | \- | N
size | String | '40rpx' | \- | N
size | String | '20px' | \- | N
text | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
theme | String | circular | options: circular/spinner/dots | N
### Loading External Classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ loading | Boolean | true | 是否处于加载状态 | N
pause | Boolean | false | 是否暂停动画 | N
progress | Number | - | 加载进度 | N
reverse | Boolean | - | 加载动画是否反向 | N
size | String | '40rpx' | 尺寸,示例:40rpx/20px | N
size | String | '20px' | 尺寸,示例:20px | N
text | String / Slot | - | 加载提示文案。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
theme | String | circular | 加载组件类型。可选项:circular/spinner/dots | N
### Loading External Classes
Expand Down
11 changes: 3 additions & 8 deletions packages/products/tdesign-miniprogram/src/loading/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const props: TdLoadingProps = {
externalClasses: {
type: Array,
},
/** 是否显示加载指示符 */
/** 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符 */
indicator: {
type: Boolean,
value: true,
Expand Down Expand Up @@ -53,15 +53,10 @@ const props: TdLoadingProps = {
reverse: {
type: Boolean,
},
/** 尺寸,示例:40rpx/20px */
/** 尺寸,示例:20px */
size: {
type: String,
value: '40rpx',
},
/** 自定义组件样式 */
style: {
type: String,
value: '',
value: '20px',
},
/** 加载提示文案 */
text: {
Expand Down
16 changes: 4 additions & 12 deletions packages/products/tdesign-miniprogram/src/loading/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface TdLoadingProps {
value?: ['t-class', 't-class-text', 't-class-indicator'];
};
/**
* 是否显示加载指示符
* 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符
* @default true
*/
indicator?: {
Expand Down Expand Up @@ -83,21 +83,13 @@ export interface TdLoadingProps {
value?: boolean;
};
/**
* 尺寸,示例:40rpx/20px
* @default '40rpx'
* 尺寸,示例:20px
* @default '20px'
*/
size?: {
type: StringConstructor;
value?: string;
};
/**
* 自定义组件样式
* @default ''
*/
style?: {
type: StringConstructor;
value?: string;
};
/**
* 加载提示文案
*/
Expand All @@ -111,6 +103,6 @@ export interface TdLoadingProps {
*/
theme?: {
type: StringConstructor;
value?: 'circular' | 'spinner' | 'bar' | 'error' | 'dots';
value?: 'circular' | 'spinner' | 'dots';
};
}
20 changes: 20 additions & 0 deletions packages/products/tdesign-mobile-react/src/loading/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdLoadingProps } from './type';

export const loadingDefaultProps: TdLoadingProps = {
attach: '',
delay: 0,
duration: 800,
fullscreen: false,
indicator: true,
inheritColor: false,
layout: 'horizontal',
loading: true,
pause: false,
preventScrollThrough: true,
size: '20px',
theme: 'circular',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
:: BASE_DOC ::

## API

### Loading Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
attach | String / Function | '' | Typescript:`AttachNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
delay | Number | 0 | \- | N
duration | Number | 800 | \- | N
fullscreen | Boolean | false | \- | N
indicator | TNode | true | Typescript:`boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
inheritColor | Boolean | false | \- | N
layout | String | horizontal | options: horizontal/vertical | N
loading | Boolean | true | \- | N
pause | Boolean | false | \- | N
preventScrollThrough | Boolean | true | \- | N
reverse | Boolean | - | \- | N
size | String | '20px' | \- | N
text | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
theme | String | circular | options: circular/spinner/dots | N

### loading 或 LoadingPlugin

name | params | default | description
-- | -- | -- | --
options | Function | - | required。Typescript:`boolean \| TdLoadingProps`

插件返回值:`LoadingInstance【interface LoadingInstance { hide: () => void }】`
34 changes: 34 additions & 0 deletions packages/products/tdesign-mobile-react/src/loading/loading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
:: BASE_DOC ::

## API

### Loading Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
attach | String / Function | '' | 挂载元素,默认挂载到组件本身所在的位置。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`AttachNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
children | TNode | - | 子元素,同 content。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
content | TNode | - | 子元素。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N
fullscreen | Boolean | false | 是否显示为全屏加载 | N
indicator | TNode | true | 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符。TS 类型:`boolean \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
inheritColor | Boolean | false | 是否继承父元素颜色 | N
layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N
loading | Boolean | true | 是否处于加载状态 | N
pause | Boolean | false | 是否暂停动画 | N
preventScrollThrough | Boolean | true | 防止滚动穿透,全屏加载模式有效 | N
reverse | Boolean | - | 加载动画是否反向 | N
size | String | '20px' | 尺寸,示例:20px | N
text | TNode | - | 加载提示文案。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
theme | String | circular | 加载组件类型。可选项:circular/spinner/dots | N

### loading 或 LoadingPlugin

参数名称 | 参数类型 | 参数默认值 | 参数描述
-- | -- | -- | --
options | Function | - | 必需。TS 类型:`boolean \| TdLoadingProps`

插件返回值:`LoadingInstance【interface LoadingInstance { hide: () => void }】`
92 changes: 92 additions & 0 deletions packages/products/tdesign-mobile-react/src/loading/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode, AttachNode } from '../common';

export interface TdLoadingProps {
/**
* 挂载元素,默认挂载到组件本身所在的位置。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
* @default ''
*/
attach?: AttachNode;
/**
* 子元素,同 content
*/
children?: TNode;
/**
* 子元素
*/
content?: TNode;
/**
* 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒
* @default 0
*/
delay?: number;
/**
* 加载动画执行完成一次的时间,单位:毫秒
* @default 800
*/
duration?: number;
/**
* 是否显示为全屏加载
* @default false
*/
fullscreen?: boolean;
/**
* 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符
* @default true
*/
indicator?: TNode;
/**
* 是否继承父元素颜色
* @default false
*/
inheritColor?: boolean;
/**
* 对齐方式
* @default horizontal
*/
layout?: 'horizontal' | 'vertical';
/**
* 是否处于加载状态
* @default true
*/
loading?: boolean;
/**
* 是否暂停动画
* @default false
*/
pause?: boolean;
/**
* 防止滚动穿透,全屏加载模式有效
* @default true
*/
preventScrollThrough?: boolean;
/**
* 加载动画是否反向
*/
reverse?: boolean;
/**
* 尺寸,示例:20px
* @default '20px'
*/
size?: string;
/**
* 加载提示文案
*/
text?: TNode;
/**
* 加载组件类型
* @default circular
*/
theme?: 'circular' | 'spinner' | 'dots';
}

export interface LoadingInstance {
hide: () => void;
}

export type LoadingMethod = (options: boolean | TdLoadingProps) => LoadingInstance;
61 changes: 14 additions & 47 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -70822,7 +70822,8 @@
"1",
"2",
"4",
"8"
"8",
"16"
],
"component": "Loading",
"field_category": 1,
Expand Down Expand Up @@ -70854,7 +70855,8 @@
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String",
Expand Down Expand Up @@ -71127,7 +71129,8 @@
"1",
"2",
"4",
"8"
"8",
"16"
],
"component": "Loading",
"field_category": 1,
Expand Down Expand Up @@ -71158,7 +71161,8 @@
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Boolean"
Expand Down Expand Up @@ -71565,47 +71569,6 @@
"Boolean"
]
},
{
"id": 950,
"platform_framework": [
"16",
"32",
"64"
],
"component": "Loading",
"field_category": 1,
"field_name": "size",
"field_type": [
"1"
],
"field_default_value": "'40rpx'",
"field_enum": "",
"field_desc_zh": "尺寸,示例:40rpx/20px",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2021-02-20 04:05:27",
"update_time": "2021-07-14 09:24:20",
"event_output": null,
"custom_field_type": "",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": null,
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"React(Mobile)",
"Angular(Mobile)",
"Miniprogram"
],
"field_type_text": [
"String"
]
},
{
"id": 1298,
"platform_framework": [
Expand Down Expand Up @@ -71650,7 +71613,9 @@
{
"id": 1712718396,
"platform_framework": [
"8"
"8",
"16",
"64"
],
"component": "Loading",
"field_category": 1,
Expand Down Expand Up @@ -71678,7 +71643,9 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)",
"Miniprogram"
],
"field_type_text": [
"String"
Expand Down

0 comments on commit 5fe022a

Please sign in to comment.