Skip to content

Commit d883f8b

Browse files
docs(docs): 更新文档
1 parent 7a15c42 commit d883f8b

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

packages/docs/docs/zh/guide/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
* umd script 标签形式引入暴露全局变量 `window.vue3FormAnt``window.vue3FormAnt.default` 暴露组件
5858
* [playground](https://form.lljj.me/v3/#/demo?type=Simple&ui=VueAntForm)
5959

60+
::: warning antd 4x 版本注意:
61+
* v4版本请使用,import { JsonSchemaFormAntdV4 } from "@lljj/vue3-form-ant";
62+
* v3版本还是建议使用 default export
63+
:::
64+
6065
#### vue3 ant、naiveUi v-model 特殊处理
6166
例如 `a-input` 组件,ant vue3需要使用 `v-model:value`,但在整个框架内部 `v-model` 都是使用 `modelValue`,所以这里就需要对不一致的props通过中间组件组做转换。
6267

packages/docs/docs/zh/guide/basic-config.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ export default {
104104
105105
用于配置表单展示样式,普通json数据,非 `JSON Schema` 规范
106106

107+
#### fui:xxx function配置
108+
* `1.9.0` 版本之后,所有ui配置支持通过 `fui:xxx` 使用函数形式的配置,可接受 `parentFormData``rootFormData``prop` 三个参数。
109+
```js
110+
// 例如配置一个动态的 placeholder 属性
111+
'fui:placeholder': (parent, root, prop) => {
112+
console.log(parent, root, prop);
113+
return parent.txtColor;
114+
}
115+
```
116+
107117

108118
#### ui-schema 表达式
109119
* `0.2` 版本之后,所有 `ui:xxx` 形式的配置都支持表达式(ui:options内不支持表达式以便区分)
@@ -139,6 +149,24 @@ uiSchema = {
139149
// 覆盖schema description
140150
'ui:description': '覆盖schema description描述信息',
141151

152+
// 通过 fui:xxx 配置function 来计算当前的ui options
153+
'fui:placeholder': (parent, root, prop) => {
154+
console.log(parent, root, prop);
155+
return parent.txtColor;
156+
},
157+
158+
// 针对单个字段配置是否需要 required,优先级高于schema的配置'
159+
// bool 类型, 'ui:required': true,
160+
// 默认 undefined
161+
'ui:required': true,
162+
163+
// 针对数组项的操作回调
164+
// 默认 undefined
165+
// command 枚举值 moveUp | moveDown | remove | add | batchPush | setNewTarget
166+
'ui:afterArrayOperate': (formData, command, payload) => {
167+
debugger;
168+
},
169+
142170
// 表单元素输入为空时的值,默认 undefined
143171
'ui:emptyValue': undefined,
144172

packages/docs/docs/zh/rules/array.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
## 其它配置
257257
* 支持通过配置 `ui-schema` 中的 `ui:addable``ui:sortable``ui:removable` 配置数组是否可添加/排序/移除
258258
* 支持通过配置 `ui-schema` 中的 `ui:showIndexNumber` 配置是否显示数组item序号
259+
* 支持通过配置 `ui-schema` 中的 `ui:afterArrayOperate` 来回调数组的相关操作
259260
* 参见 [ui-schema 配置](https://form.lljj.me/#/demo?type=Arrays)
260261

261262
如:
@@ -265,7 +266,10 @@ uiSchema = {
265266
addable: false,
266267
sortable: false,
267268
removable: false,
268-
showIndexNumber: true
269+
showIndexNumber: true,
270+
'ui:afterArrayOperate': (formData, command, payload) => {
271+
debugger;
272+
},
269273
}
270274
}
271275
```

0 commit comments

Comments
 (0)