mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-01-27 12:28:31 +00:00
1.8 KiB
1.8 KiB
DynamicField 动态表单
根据模型中某个字段的值,动态生成一组表单字段。
基础用法
<template #source>
当“类型”发生变化时,“动态字段”会根据 returnFields 返回的配置生成不同的输入框。
:::warning
特别注意:dynamic-field 的上一级配置必须设置 extensible: true,才能保存未在 schema 中声明的动态字段。
:::
Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| type | 组件类型 | string | dynamic-field | — |
| text | 表单标签 | string | — | — |
| dynamicKey | 监听的字段名。当该字段值变化时,触发 returnFields 重新计算 |
string | — | — |
| returnFields | 返回字段列表的函数 | (config, model, request) => Promise<Field[]> | — | — |
Field 对象结构
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| name | 字段名 | string | — |
| label | 标签名 | string | — |
| defaultValue | 默认值 | any | — |