Script Development / Function Page DFF.FUNC_PAGE
To facilitate function invocation, DataFlux Func can automatically generate directly callable operation pages for functions, eliminating the need for front-end development.
1. Example
In a function decorated with @DFF.API, returning a FUNC_PAGE object enables the "Function Page" feature.
| Example | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
After creating a "Function API" for func_page, open it in a browser:
Page styles may change with version updates
As DataFlux Func versions are updated, the style of function pages generated by the same code may vary.
2. FUNC_PAGE Object
The API for FUNC_PAGE is as follows:
.set_title(...)
Set the page title:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
title |
str | Required | Title content |
| Example | |
|---|---|
1 | |
.add_html(...)
Add an HTML block:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
tag |
str | Required | HTML tag, such as "h1", "p", "span", "hr" |
text |
str | Tag content |
| Example | |
|---|---|
1 | |
.add_func(...)
Add a function block:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
func_id |
str | Required | Function ID, such as "demo__test.run" |
| Example | |
|---|---|
1 | |