diff --git a/src/demo/api.md b/docs/api.md similarity index 100% rename from src/demo/api.md rename to docs/api.md diff --git a/docs/func.md b/docs/func.md new file mode 100644 index 00000000..4e3af6e7 --- /dev/null +++ b/docs/func.md @@ -0,0 +1,31 @@ +--- +title: Func +group: + title: Func + path: /func +nav: + title: API + path: /api +--- + +# 方法 + +## 使用方法 + +```js +import { + dateChange, + getByteLen, + getRandom, + transformFile, +} from '@alitajs/dform'; +``` + +## API + +| 参数 | 说明 | 类型 | +| ------------- | --------------------------------------------------------------------------- | --------------------------------------------------------- | +| dateChange | 对日期格式进行转化,保证值在 `Safari` 能正常展示,使用方法请参考 `Date` 组件 | `(date: Date \| string) => new Date(YYYY,MM,DD,HH,mm,ss)` | +| getByteLen | 获取字符串的字节数量 | `(val: string) => number` | +| getRandom | 获取随机值 | `() => string` | +| transformFile | 压缩图片 | `(file:File, pictureQuality: 压缩比例(0~1)) => File` | diff --git a/src/utils/index.tsx b/src/utils/index.tsx index 3374ad39..d47530ea 100644 --- a/src/utils/index.tsx +++ b/src/utils/index.tsx @@ -1,3 +1,8 @@ +/** + * 这里为用户可使用的公共方法 + * 如需写些内部的工具类 + * 请编辑在 `tool.ts` 文件下 + */ import dayjs from 'dayjs'; import { FormInstance } from 'rc-field-form/es/interface';