[Vuejs]-Laravel vue, using vue code in blade template

0👍

To do this you need to use scoped slots.

In your autocomplete.vue you would need to insert a slot and the provide the slot with the item.

Roughly speaking –

Autocomplete:

<template>
    <slot :item="item"></slot>
</template>

// ...script etc

Blade view:

<autocomplete :items="items" v-model="item" :get-label="getLabel" :component-item='template' @update-items="updateItems">
    <template v-slot:default="slotProps">
        @{{ slotProps.item }}
    </template>

    // OR
    <template v-slot:default="{item}">
        @{{ item }}
    </template>
</autocomplete>

Leave a comment