Skip to content

Components don't get attached if transcluded in parent components that have v-if #684

Closed
@cheapsteak

Description

@cheapsteak

The transcluded component is rendered in the DOM but the attached event never fires.

Fiddle: http://jsfiddle.net/6Lt7kc94/3/

parent component
<div v-component="child">
    <div v-component="transcluded"></div>
</div>
child component (visible is hardcoded to true)
<div v-if="visible">
    <content></content>
</div>
transcluded component
var globals = {};
var transcludedComponent = Vue.extend({
    template: "<div>blarg</div>",
    compiled: function () {
        globals.el = this.$el;
        // globals.el ends up inside a #document-fragment
    },
    attached: function () {
        alert('attached');
    }
});

If v-if="visible" is deleted then everything works.
Am I using this incorrectly or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions