1
0
mirror of synced 2026-04-03 06:28:35 +08:00

docs: 1.2.0文档

This commit is contained in:
roymondchen
2022-12-01 17:38:05 +08:00
parent c143a5f767
commit f6262be397
92 changed files with 4161 additions and 3901 deletions

View File

@@ -0,0 +1,27 @@
# FormDialog组件 events
## close
- **详情:** 弹出关闭
- **回调函数:** () => void
## submit
- **详情:** 调用[save()](./form-dialog-methods.md#save)
- **回调函数:** (values: any) => void
## error
- **详情:** 表单校验不同
- **回调函数:** (error: any) => void
## change
- **详情:** 表单中任何值发生变化
- **回调函数:** (values: any) => void

View File

@@ -0,0 +1,13 @@
# FormDialog组件 methods
## cancel
- **详情:** 关闭弹窗
## save
- **返回:**
- `{Promise<any>}`
- **详情:** 获取表单的值

View File

@@ -0,0 +1,110 @@
# FormDialog组件 props
## config
- **详情:** 表单配置
- **默认值:** `[]`
- **类型:** [FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)
- **示例:**
```html
<template>
<m-form-dialog :config="config"></m-form-dialog>
</template>
<script setup>
import { ref } from 'Vue';
const config = ref([
{
name: 'text',
text: '文本',
},
{
name: 'multiple',
text: '多行文本',
type: 'switch',
},
]);
</script>
```
## values
- **详情:** 表单初始化值
- **默认值:** `{}`
- **类型:** `Object`
- **示例:**
```html
<template>
<m-form-dialog :values="values"></m-form-dialog>
</template>
<script setup>
import { ref } from 'Vue';
const values = ref([
text: 'text',
multiply: true,
]);
</script>
```
## width
- **详情:** 弹窗宽度
- **类型:** `string | number`
## labelWidth
- **详情:**
表单域标签的宽度,例如 '50px'。 作为 Form 直接子元素的 form-item 会继承该值。 支持 auto
- **默认值:** `'200px'`
- **类型:** `string | number`
## fullscreen
- **详情:** 弹出是否全屏
- **默认值:** false
- **类型:** boolean
## disabled
- **详情:** 是否禁用该表单内的所有组件。 若设置为 true则表单内组件上的 disabled 属性不再生效
- **默认值:** false
- **类型:** `boolean`
## title
- **详情:** 弹出标题
- **类型:** `string`
## size
- **详情:** 用于控制该表单内组件的尺寸
- **类型:** `'small' | 'default' | 'large'`
## confirmText
- **详情:** 提交按钮文案
- **默认值:** `'确定'`
- **类型:** `string`

View File

@@ -0,0 +1,7 @@
# Form组件 events
## change
- **详情:** 表单中任何值发生变化
- **回调函数:** (values: any) => void

View File

@@ -0,0 +1,13 @@
# Form组件 methods
## resetForm
- **详情:** 重置该表单项,将其值重置为初始值,并移除校验结果
## submitForm
- **返回:**
- `{Promise<any>}`
- **详情:** 提交表单,获取表单的值

137
docs/api/form/form-props.md Normal file
View File

@@ -0,0 +1,137 @@
# Form组件属性 props
## config
- **详情:** 表单配置
- **默认值:** `[]`
- **类型:** [FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)
- **示例:**
```html
<template>
<m-form-dialog :config="config"></m-form-dialog>
</template>
<script setup>
import { ref } from 'Vue';
const config = ref([
{
name: 'text',
text: '文本',
},
{
name: 'multiple',
text: '多行文本',
type: 'switch',
},
]);
</script>
```
## initValues
- **详情:** 表单初始化值
- **默认值:** `{}`
- **类型:** `Object`
- **示例:**
```html
<template>
<m-form-dialog :init-values="initValues"></m-form-dialog>
</template>
<script setup>
import { ref } from 'Vue';
const initValues = ref([
text: 'text',
multiply: true,
]);
</script>
```
## labelWidth
- **详情:**
表单域标签的宽度,例如 '50px'。 作为 Form 直接子元素的 form-item 会继承该值。 支持 auto
- **默认值:** `'200px'`
- **类型:** `string | number`
## disabled
- **详情:** 是否禁用该表单内的所有组件。 若设置为 true则表单内组件上的 disabled 属性不再生效
- **默认值:** false
- **类型:** `boolean`
## height
- **详情:**
- **默认值:**
- **类型:**
## stepActive
- **详情:**
- **默认值:**
- **类型:**
## size
- **详情:** 用于控制该表单内组件的尺寸
- **类型:** `'small' | 'default' | 'large'`
## inline
- **详情:** 行内表单模式
- **默认值:** false
- **类型:** `boolean`
## labelPosition
- **详情:** 表单域标签的位置, 当设置为 left 或 right 时,则也需要设置 label-width 属性
- **默认值:** right'
- **类型:** `'left' | 'right' | 'top`
## keyProp
- **详情:** 作为表单项的组件实例的key
- **默认值:** `'__key'`
- **类型:** `string`
## popperClass
- **详情:** tooltip弹出层的class
- **类型:** `string`