[Vuejs]-Template content is not being injected into slot

0👍

I’m not sure that slots are designed for this. If you are just changing the text of a button passing props into the parentComponent is how i would go about it. E.g.

<parentComponent buttonText="some text or bind with a data value or computed prop"/>

see: https://v2.vuejs.org/v2/guide/components-props.html

Using slots… If you are experimenting try this, a reusable dialog box that you can pop in anywhere and control the content. E.g.

// myDialog
<v-dialog>
    <slot>Here you can put what you want</slot>
</v-dialog>

And to use:

<myDialog>
    <template>
        <myContent /> Or just put content here without another component
    </template>
</myDialog>

0👍

I fixed the error. I don’t know the reason, but it wasn’t working either if I loaded Vue.js from a CDN, or if I manually downloaded it locally, as a single file.

Then I finally tried installing it from npm, and loading Vue.js in node_modules/vue/dist/vue.js, and this way it works. I assume otherwise Vue.js does not comply with all its functionality.

Leave a comment