Skip to content

Registration multiple components with different parents #340

Closed
@Krzysiu-lifeinmobile

Description

@Krzysiu-lifeinmobile

I work hard with Vue components and encountered a problem.

I want to create a structure like this:

<app>
         <add>
            <upload></upload>
        </add>
        <list>
            <modal>
                <edit>
                    <upload></upload>
                </edit>
            </remove><remove>
            </modal>
            <item></item>
            ...
            <item></item>
        </list>
</app>

I have a 'app' which is a root. Two children: 'add' and 'list' component etc. Everything works great, is displaying properly etc. without one things:
I want register twice a 'upload' component. In 'upload' component I have a method eq. "doSomething" which appeals to parent - accordingly to the 'add' component, and to the 'edit' component. The upload component is created by var Upload= Vue.extend({ /* ... */ }), and locally connected to the appropriate components.

When I call the method "doSomething" it always appeals to the first registered component - in above case to the 'add' component. I can't appeal to the right parent component.
I want appeals to parent separately - one keys to the 'add', other to the 'edit'..

Do someone have a solution for this problem? Or maybe it is impossible to do?

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