Stages & Components: Creating Single Stage
What are we learning here?
Stages & Components Relations: ββββββββββββββββββββββββ
ββoptionalβββββΊβ Component Element(s) β β β
βββββββββββββββββ βββββββββββββ β ββββββββββββββββββββββββ β
β Initial Stage ββloadβββΊβ Component ββprovidesββ€ β
βββββββββββββββββ βββββββββββββ β ββββββββββββ β
β² ββat least oneββΊβ Stage(s) βββ create β β β
β ββββββ¬ββββββ
β β
β β β β β β β β β load β β β β β β β ββ
System Hierarchy:
βΊ Initial Stage
ββΊ Root Component
ββΊ Stage "main"
ββΊ Application
ββΊ Stage "main"
ββΊ Widget
ββΊ Component Element "main"
ββΊ Custom Stage
- Create stages with
registerStage()
In each component which provide a component element (for example, in the widget component we know) can we create further stages.
As we know, in a component element you can add any HTML elements. Each of these HTML elements can be defined as a stage.
Let's add an element into our HTML structure in which we create a stage:
src/demo/apps/component-basics/content.ejs.html
We now use the method registerStage() to convert the element taged with data-role=stage into a
stage.
src/demo/apps/component-basics/content.js
Since the "stage" is still empty, you can't see anything special yet.
Convert a component element to a stage
You can even convert the entire component element into a stage if necessary:
Stages and flexbox
We do not use the <div class="card-body"> to create the stage because this is a flexbox
child which collide with the flexbox handling of a stage and would collapse to a zero height.
We will explain details of that topic later.