# BsForm 文档

l

<template>
  <DocTable
    :table-data="tableData"
  />
</template>

<script>
  export default {
    data() {
      return {
        tableData: [
          {
            keyName: 'Props',
            desc: '参数',
            type: '',
            enum: '',
            defVal: '',
            emc: '',
            children: [
              {
                keyName: 'editable',
                desc: '表单是否可编辑',
                type: 'boolean',
                enum: '',
                defVal: 'true',
                emc: ''
              },
              {
                keyName: 'uneditableBorder',
                desc: '表单不可编辑时是否显示边框',
                type: 'boolean',
                enum: '',
                defVal: 'true',
                emc: ''
              },
              {
                keyName: 'moneyInputSwich',
                desc: '是否开启录入金额单位切换',
                type: 'boolean',
                enum: '',
                defVal: 'true',
                emc: ''
              },
              {
                keyName: 'defaultMoneyUnit',
                desc: '默认金额单位',
                type: 'number',
                enum: '',
                defVal: '1',
                emc: ''
              },
              {
                keyName: 'moneyUnitOptions',
                desc: '金额单位选项配置',
                type: 'array',
                enum: '',
                defVal: `[ { value: 1, label: '元', inputDigits: 2, viewDigits: 2 }, { value: 10000, label: '万元', inputDigits: 6, viewDigits: 6 } ]`,
                emc: ''
              },
              {
                keyName: 'formGloabalConfig',
                desc: '表单全局配置',
                type: 'Object',
                enum: '',
                defVal: '',
                emc: '',
                children: [
                  {
                    keyName: 'span',
                    desc: '所有项的栅格占据的列数(共 24 分栏)',
                    type: 'String, Number',
                    enum: '',
                    defVal: '8',
                    emc: ''
                  },
                  {
                    keyName: 'align',
                    desc: '所有项的内容对齐方式',
                    type: 'String',
                    enum: '',
                    defVal: 'left',
                    emc: ''
                  },
                  {
                    keyName: 'size',
                    desc: '尺寸',
                    type: 'string',
                    enum: 'medium, small, mini',
                    defVal: 'medium',
                    emc: ''
                  },
                  {
                    keyName: 'titleAlign',
                    desc: '所有项的标题对齐方式',
                    type: 'string',
                    enum: '',
                    defVal: 'right',
                    emc: ''
                  },
                  {
                    keyName: 'titleWidth',
                    desc: '所有项的标题宽度',
                    type: 'String, Number',
                    enum: '',
                    defVal: '200',
                    emc: ''
                  },
                  {
                    keyName: 'titleColon',
                    desc: '是否显示标题冒号',
                    type: 'boolean',
                    enum: '',
                    defVal: 'false',
                    emc: ''
                  },
                  {
                    keyName: 'preventSubmit',
                    desc: '是否禁用默认的回车提交方式,禁用后配合 validate() 方法可以更加自由的控制提交逻辑',
                    type: 'boolean',
                    enum: '',
                    defVal: 'false',
                    emc: ''
                  },
                  {
                    keyName: 'loading',
                    desc: '是否加载中',
                    type: 'boolean',
                    enum: '',
                    defVal: 'false',
                    emc: ''
                  }
                ]
              },
              {
                keyName: 'formItemsConfig',
                desc: '表单项配置: 具体配置请查阅各个渲染器配置 并 结合vxe-form的Props.items',
                type: '[{}]',
                enum: '',
                defVal: '',
                emc: ''
              },
              {
                keyName: 'calculateConstraintConfig',
                desc: '计算和约束配置',
                type: 'Object',
                enum: '',
                defVal: '',
                emc: '',
                children: [
                  {
                    keyName: 'enabled',
                    desc: '是否开启此项功能',
                    type: 'boolean',
                    enum: '',
                    defVal: 'true',
                    emc: ''
                  },
                  {
                    keyName: 'enabledType',
                    desc: '执行开关',
                    type: 'Object',
                    enum: '',
                    defVal: ' { initPerformConstraint: false, performFormula: true, performConstraint: false } ',
                    emc: '',
                    children: [
                      {
                        keyName: 'initPerformConstraint',
                        desc: '是否初始化先执行一次约束',
                        type: 'boolean',
                        enum: '',
                        defVal: 'false',
                        emc: ''
                      },
                      {
                        keyName: 'performFormula',
                        desc: '项公式',
                        type: 'boolean',
                        enum: '',
                        defVal: 'true',
                        emc: ''
                      },
                      {
                        keyName: 'performConstraint',
                        desc: '项约束',
                        type: 'boolean',
                        enum: '',
                        defVal: 'false',
                        emc: ''
                      }
                    ]
                  },
                  {
                    keyName: 'itemFormulaConfig',
                    desc: '项公式配置',
                    type: 'Object',
                    enum: '',
                    defVal: '{}',
                    emc: ''
                  },
                  {
                    keyName: 'constraintConfig',
                    desc: '项约束配置',
                    type: 'Object',
                    enum: '',
                    defVal: '{}',
                    emc: ''
                  }
                ]
              },
              {
                keyName: 'formDataList',
                desc: '表单数据',
                type: 'Object',
                enum: '',
                defVal: '{}',
                emc: ''
              },
              {
                keyName: 'formValidationConfig',
                desc: '校验规则配置项: 具体配置请移步vxe-form查阅Props.rules',
                type: '[{}]',
                enum: '',
                defVal: '',
                emc: ''
              }
            ]
          },
          {
            keyName: 'Slots',
            desc: '插槽',
            type: '',
            enum: '',
            defVal: '',
            emc: ''
          },
          {
            keyName: 'Events',
            desc: '事件',
            type: '',
            enum: '',
            defVal: '',
            emc: '',
            children: [
              {
                keyName: 'onSubmitClick',
                desc: '只对 prevent-submit=false 有效,表单提交时会触发该事件',
                type: '',
                enum: '',
                defVal: '{data, $event }, bsFormContext, formContext',
                emc: ''
              },
              {
                keyName: 'submitInvalid',
                desc: '只对 prevent-submit=false 有效,表单提交时如果校验不通过会触发该事件',
                type: '',
                enum: '',
                defVal: '{ data, errMap, $event }, bsFormContext, formContext',
                emc: ''
              },
              {
                keyName: 'reset',
                desc: '表单重置时会触发该事件',
                type: '',
                enum: '',
                defVal: 'formDataListIn, bsFormContext, formContext',
                emc: ''
              },
              {
                keyName: 'toggleCollapse',
                desc: '当折叠按钮被手动点击时会触发该事件',
                type: '',
                enum: '',
                defVal: '{ collapse, data, $event }, bsFormContext, formContext',
                emc: ''
              },
              {
                keyName: 'itemChange',
                desc: '表单项改变时触发的事件',
                type: '',
                enum: '',
                defVal: 'obj, bsFormContext',
                emc: ''
              }
            ]
          },
          {
            keyName: 'Methods',
            desc: '方法',
            type: '',
            enum: '',
            defVal: '',
            emc: '',
            children: [
              {
                keyName: 'clearValidate',
                desc: '手动清除校验状态,如果指定 field 则清除指定的项,否则清除整个表单',
                type: 'Promise',
                enum: '',
                defVal: 'field?: string',
                emc: ''
              },
              {
                keyName: 'updateStatus',
                desc: '更新项状态(当使用自定义渲染时可能会用到)',
                type: 'Promise',
                enum: '',
                defVal: 'scope: { property }',
                emc: ''
              },
              {
                keyName: 'formOptionsFn',
                desc: '返回vxe-form实例',
                type: '',
                enum: '',
                defVal: '',
                emc: ''
              },
              {
                keyName: 'getFormData',
                desc: '获取表单数据【是深拷贝后的】',
                type: '',
                enum: '',
                defVal: '',
                emc: ''
              },
              {
                keyName: 'getPureFormData',
                desc: '获取纯净的表单数据',
                type: '',
                enum: '',
                defVal: '',
                emc: ''
              },
              {
                keyName: 'validate',
                desc: '校验',
                type: '',
                enum: '',
                defVal: '',
                emc: ''
              },
              {
                keyName: '...',
                desc: '其它方法: 参考vxe-form的Methods, 可以通过formOptionsFn获取vxe-form实例后,直接使用vxe-from的Methods方法',
                type: '',
                enum: '',
                defVal: '',
                emc: ''
              }
            ]
          }
        ]
      }
    }
  }
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
Expand Copy