Defer Loading
You can use the wire:init Directive to execute an action as soon as your component is rendered.
This can be helpful in cases where you don't want to hold up the entire page load, but want to load some data immediately after the page load.
<div wire:init="loadTasks">
<ul>
<cfloop array="#args.tasks#" index="task">
<li>#task#</li>
</cfloop>
</ul>
</div>
component extends="cbwire.models.Component" {
property name="taskService" inject="[email protected]";
data = {
"tasks": []
};
function loadTasks(){
data.tasks = taskService.asMemento().get();
}
}
Export as PDF
Copy link