new Page(parent, propsopt)
Page component that extends the base Component_A class. This component handles the layout and rendering of a page. This class focuses on the specific properties of the Page component. Since it inherits from Accessor_A, all basic properties (e.g., height, width) are available but documented in the Accessor_A part.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
parent | HTMLElement | The parent HTML element that will contain the Page component. | ||
props | TComponents. | <optional> | {} | The properties to initialize the Page component. |
- Source
const page = new TComponents.Page(document.body,{
position: 'absolute',
zIndex: 1000,
width: 200,
height: 150,
backgroundColor: 'blue',
})
// Render the component.
page.render();Extends
Members
properties :TComponents.PageProps
Sets the properties of the Page component. Note that changing this property will not cause the component to refresh directly.
- Source
const page = new TComponents.Page(document.body,{
position: 'absolute',
zIndex: 1000,
width: 200,
height: 150,
backgroundColor: 'blue',
})
// Render the component.
page.render();
page.properties = {backgroundColor: 'red'};Methods
appendChild(t)
Appends a child component to the Page.
| Name | Type | Description |
|---|---|---|
t | TComponents. | The child component to be appended. |
- Source
const page = new TComponents.Page(document.body,{
position: 'absolute',
zIndex: 1000,
width: 200,
height: 150,
backgroundColor: 'blue',
})
// Render the component.
page.render();
// Create a button
const button = new TComponents.Button(null, {text: 'Click me'});
page.appendChild(button);(protected) defaultProps() → {TComponents.PageProps}
Returns the default values of class properties (excluding parent properties).
- Overrides
- Source
- Type:
- TComponents.
PageProps
getCssText() → {string}
Generates the CSS text for the Page component based on its properties.
- Source
The CSS text for the Page component.
- Type:
- string
mapComponents() → {object}
Maps the child components of the Page.
- Source
- Type:
- object
markup() → {string}
Generates the HTML markup for the Page component.
- Overrides
- Source
The HTML markup for the Page component.
- Type:
- string
onInit() → {void}
Initializes the Page component. This method is called during the component's initialization phase.
- Overrides
- Source
Throws an error if initializing fails.
- Type
- Error
- Type:
- void
onRender() → {void}
Renders the Page component. This method is responsible for cleaning up events and updating the DOM.
- Overrides
- Source
Throws an error if rendering fails.
- Type
- Error
- Type:
- void
removeChild(t)
Removes a child component from the Page.
| Name | Type | Description |
|---|---|---|
t | TComponents. | The child component to be removed. |
- Source
const page = new TComponents.Page(document.body,{ ... });
// Remove the button.
page.removeChild(button)