Constructor
new DefaultViewController()
- Source:
DefaultViewController Constructor
Example
class PageController extends Craft.UI.DefaultViewController {
constructor(){
super();
this.tags = '';
this.items = '';
}
viewDidLoad(callback){
this.appendView(new Header());
this.appendView(new Container());
this.appendView(new Footer());
}
style(componentId){
return `
* { box-sizing:border-box; margin:0; padding:0; }
.root { display:flex; flex-direction:column; width:75%; margin-left:auto; margin-right:auto; }
`;
}
template(componentId){
return `<div id="root" class="root"></div>`;
}
}
Classes
Methods
viewDidLoad(callback)
- Source:
overriding viewDidLoad with 'ContentTapped' event on this.view
When you override this method, you have to call super.viewDidLoad()
at the start of yours,
and you have to call callback
at the end of yours.
But if you don't want to enable 'ContentTapped' event, don't call super.viewDidLoad
.
Example
viewDidLoad(callback){
super.viewDidLoad();
// your original logic
if(callback){ callback(); }
}
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | callback |
(protected) enableContentTapped()
- Source:
Append 'ContentTapped' event on this.view
appendSubView(options)
- Source:
ovverride appendView: with viewController cascading
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | options|component Properties
|
(protected) style()
- Source:
style
(protected) template()
- Source:
template