Nesting Components
// wires/ContactUs.bx
class extends="cbwire.models.Component" {
data = {
"showForm": false
};
}// wires/ContactUs.cfc
component extends="cbwire.models.Component" {
data = {
"showForm": false
};
}<!--- wires/contactus.bxm --->
<bx:output>
<div>
<bx:if showForm>
<!--- Nested component --->
#wire( name="ContactForm" )#
</bx:if>
<button wire:click="$toggle( 'showForm' )">Toggle form</button>
</div>
</bx:output><!--- wires/contactus.cfm --->
<cfoutput>
<div>
<cfif showForm>
<!--- Nested component --->
#wire( name="ContactForm" )#
</cfif>
<button wire:click="$toggle( 'showForm' )">Toggle form</button>
</div>
</cfoutput>// wires/ContactUs.bx
class extends="cbwire.models.Component" {
data = {
"showForm": false,
"sendEmail": false,
"validateForm": true
};
function onMount( params ) {
data.sendEmail = params.sendEmail;
data.validateForm = params.validateForm;
}
}// wires/ContactUs.cfc
component extends="cbwire.models.Component" {
data = {
"showForm": false,
"sendEmail": false,
"validateForm": true
};
function onMount( params ) {
data.sendEmail = params.sendEmail;
data.validateForm = params.validateForm;
}
}Using Keys with Nested Components
Why Keys Matter
Basic Key Usage
Dynamic Keys for Component Lists
Key Guidelines
Was this helpful?