The component library is developed based on amis
, which uses JSON configuration to generate pages, reducing page development workload and greatly improving efficiency. However, a large number of JSON configurations can lead to poor code readability and high maintenance costs. Therefore, EaseAdmin
has encapsulated Amis
' 150+
components, making Amis
page construction more concise and efficient.
All Amis
components are located in the easeadmin/builder
directory. The calling method is the same as the property name
in the Amis
component library property table, and the parameters correspond to the property values
. You can find detailed information about the components in the amis documentation.
The following is the property table of a Container
component. You can create a component object through the make
method to chain call all the properties in the Container
component property table.
Property Name | Type | Default Value | Description |
---|---|---|---|
type | string | "container" | Specify as container renderer |
className | string | CSS class name of the outer Dom | |
bodyClassName | string | CSS class name of the container content area | |
wrapperComponent | string | "div" | Container tag name |
style | object | Custom style | |
body | SchemaNode | Container content |
Or use the built-in amis method to create component objects.
The above example will output Amis
JSON
You can find almost all amis
components in EaseAdmin
, which all inherit from the Schema
class and have the following public methods.
Method Name | Parameters | Description |
---|---|---|
make | None | Create a component instance |
id | string | Set component id |
find | string | Find component by ID |
type | string | Set component type |
attr | string,any,string? | Set custom property |
style | object | Set component style |
className | string | Set component class name |
definitions | object | Set component definitions |
permission | boolean | Set whether to render the component |
onEvent | object | Set component events |
remove | string? | Remove component property |
If you cannot find the component or property you need, you can set the property you need through the attr
method of Schema
.
With EaseAdmin
, you will find that building pages with AdonisJS
backend code is so simple.
EaseAdmin
provides a parser
method to convert json
to amis
code. This feature is also built into the Developer
tool in the backend.
Converted Code