|
9 | 9 | ## descriptor |
10 | 10 |
|
11 | 11 | ::: tip Warm Prompt |
12 | | -**descriptor** can be `object` or `array`, but the `fields`, `defaultFields`, `label`, `placeholder`, `hidden`, `disabled`, `options`, `autocomplete` props should be brother props with `type`. In addition, there is only one object include `type` prop in array. |
| 12 | +**descriptor** can be `object` or `array`, but the `fields`, `defaultFields`, `label`, `hidden`, `disabled`, `options`, `component` props should be brother props with `type`. In addition, there is only one object include `type` prop in array. |
13 | 13 | ::: |
14 | 14 |
|
15 | 15 | ### type |
16 | 16 |
|
17 | 17 | `string`, declare the type of data's field, include common data type. |
18 | 18 |
|
| 19 | +::: warning 注意 |
| 20 | + |
| 21 | +Note that [descriptor.component.name](/zh/api/descriptors/#props) has higher priority, the follow rules are invalid if `descriptor.component.name` is not null. |
| 22 | +::: |
| 23 | + |
19 | 24 | | Value | Description | Component | |
20 | 25 | | --------- | ------------------------------------------------------------ | ------------------- | |
21 | 26 | | `string` | Must be a string | `el-input` | |
|
36 | 41 |
|
37 | 42 | `string`, field's label in form, should be declared with `type` in the same object. |
38 | 43 |
|
39 | | -### props |
40 | | - |
41 | | -`object` type, it will be the value of input component's `v-bind` prop(input component refer to [descriptor.type](/api/descriptors/#type)). You can custom the component with this option, there are some common prop like: `placeholder`, `disabled`, ... , etc. Other props of component refer to [element-ui](https://element.faas.ele.me/#/en-US/component/installation). |
42 | | - |
43 | 44 | ### hidden |
44 | 45 |
|
45 | 46 | `boolean` , whether hidden the input component of value, should be declared with `type` in the same object. Note that the hidden value still will be validated while validating. |
@@ -206,3 +207,43 @@ const descriptors = { |
206 | 207 | } |
207 | 208 | ``` |
208 | 209 |
|
| 210 | +### component |
| 211 | + |
| 212 | +Provided for user to custom the component easily, it can custom the component's content, props and events. |
| 213 | + |
| 214 | +``` js |
| 215 | +// component demo |
| 216 | +{ |
| 217 | + name: 'el-button', |
| 218 | + props: { |
| 219 | + type: 'primary', |
| 220 | + size: 'small' |
| 221 | + }, |
| 222 | + events: { |
| 223 | + click () { |
| 224 | + console.log('button click') |
| 225 | + } |
| 226 | + } |
| 227 | +} |
| 228 | +``` |
| 229 | + |
| 230 | +#### name |
| 231 | + |
| 232 | +`string` type, custom to use which element or component. |
| 233 | + |
| 234 | +#### props |
| 235 | + |
| 236 | +`object` type, it will be the value of input component's `v-bind` prop(input component refer to [descriptor.type](/api/descriptors/#type)). You can custom the component props with this option, there are some common props like: `placeholder`, `disabled`, ... , etc. Other props of component refer to [element-ui](https://element.faas.ele.me/#/en-US/component/installation). Note that it will be the value of the custom component's `v-bind` prop, if `component.name` is not null. |
| 237 | + |
| 238 | +#### events |
| 239 | + |
| 240 | +`object` type, it will be the value of input component's `v-on` prop(input component refer to [descriptor.type](/api/descriptors/#type)). You can custom the component props with this option, there are some common prop like: `placeholder`, `disabled`, ... , etc. Other props of component refer to [element-ui](https://element.faas.ele.me/#/en-US/component/installation). Note that it will be the value of the custom component's `v-on` prop, if `component.name` is not null. |
| 241 | + |
| 242 | +#### children |
| 243 | + |
| 244 | +`children` is used to custom the content of component. It has two types: |
| 245 | + |
| 246 | +- `string` : the content is plain text. It will be inserted with `span` element |
| 247 | +- `array[component | string]` : the content has more than one element, the array item has two types: |
| 248 | + - `component` : same structure with [component](/api/descriptors/#component) |
| 249 | + - `string` : the item is plain text. It will be inserted with `span` element |
0 commit comments