Skip to content
Advertisement

Using VAutocomplete from vuetify with render function (scoped slot)

Am trying to use the Autocomplete component inside a render function. When I try to use the scopedSlots of the component it won’t work for me. My code:

  import { VAutocomplete } from 'vuetify/lib'

  export default {
    render (h) {
      return h(VAutocomplete, {
        scopedSlots: {
          label: () => h('h1', 'lol'),
          'append-item': () => h('p', 'Last item')
        },
      })
    },
  }

I tried using the answer on this post Vuetify VMenu with render function

The answer when I try it works however when I apply it to the Autocomplete it isn’t working for me in the slots I have tried. What am I doing wrong?

Advertisement

Answer

label isn’t a scoped slot, you have to do:

h(VAutocomplete, [
  h('h1', { slot: 'label' }, 'lol')
])
Advertisement