Constructor
new View()
- Source:
Example
class Hello extends Craft.UI.View {
constructor(){
super();
ths.name = 'World';
}
style(componentId){
return `
.root { font-size:1em; }
.message { color:blue; }
`;
}
template(componentId){
return `
<div id='root' class='root'>
<h1 class='message'>Hello ${this.name} !<\h1>
</div>
`;
}
}
Methods
getViewController()
- Source:
Get the ViewController this component is managed by
setViewController(viewController)
- Source:
Change viewController that manages me
Parameters:
Name | Type | Description |
---|---|---|
viewController |
Craft.Core.Component | allow any Component |