Javey/Intact

can not set block in nested component

Closed this issue · 1 comments

Javey commented

Such as

// AnotherComponent
<div>{self.get('children)}</div>
// Component
<div>
    <AnotherComponent>
        <b:body>test</b:body>
    </AnotherComponent>
</div>
<Component>
    <b:body>component</b:body>
</Component>

if AnotherComponent have not a block named body, the content wich passd as block in Component will be ignored. Because the body block is a blocks property for AnotherComponent, not children.
Howerver you can do like this:

<div>
    <AnotherComponent>
        <div>
            <b:body>test</b:body>
        </div>
    </AnotherComponent>
</div>
Javey commented

We can wrap block with template, so it will not render redundant element.

// Component
<div>
    <AnotherComponent>
        <template>
            <b:body>test</b:body>
        </template>
    </AnotherComponent>
</div>
<Component>
    <b:body>component</b:body>
</Component>

The result is:

<div>
    <div>component</div>
</div>