Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing rendered in vue3 #30

Open
v1r0x opened this issue Jan 21, 2021 · 3 comments
Open

Nothing rendered in vue3 #30

v1r0x opened this issue Jan 21, 2021 · 3 comments
Labels

Comments

@v1r0x
Copy link
Contributor

v1r0x commented Jan 21, 2021

Version(if relevant): 6.0.1

Environment(if relevant):

Vue3

Code(if relevant):

<template>
    <div>
        <tree :data="data"></tree>
    </div>
</template>
<script>
import { Node, Tree } from "tree-vue-component";
export default {
        components: {
            node: Node,
            tree: Tree,
        },
        setup(props) {
            return {
                data: [
                  {
                    text: 'node 1',
                    value: { id: 1 },
                    state: {
                    opened: true
                    },
                    children: [
                    {
                        text: 'node 11',
                        value: { id: 11 }
                    },
                    {
                        text: 'node 12',
                        value: { id: 12 },
                        state: {
                        opened: true
                        },
                        children: [
                        {
                            text: 'node 121',
                            value: { id: 121 }
                        },
                        {
                            text: 'node 122',
                            value: { id: 122 }
                        },
                        {
                            text: 'node 123',
                            value: { id: 123 }
                        }
                        ]
                    }
                    ]
                },
            ],
            };
        }
    }
</script>

Expected:

Tree should be rendered

Actual:

No tree is rendered
DOM only shows this where the tree should be rendered

<!--  -->
@plantain-00
Copy link
Owner

Tree and Node expected to registered in app, locally registered components are not also available in subcomponents.

@v1r0x
Copy link
Contributor Author

v1r0x commented Jan 22, 2021

I also tried to register them globally, but that didn't work either. But I'll retry it later and report back.

@v1r0x
Copy link
Contributor Author

v1r0x commented Jan 22, 2021

I registered the components in my main script and it still didn't work to use them in my other component CustomTree.vue. But when used in my main component (the one I create the app with const app = createApp(App);) it works. Thanks for your help!

But is it possible to use your tree component in any other component than the main component in vue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants