我正在尝试在渲染函数中使用自动完成组件。当我尝试使用组件的 scopedSlots 时,它对我不起作用。我的代码:
import { VAutocomplete } from 'vuetify/lib'
export default {
render (h) {
return h(VAutocomplete, {
scopedSlots: {
label: () => h('h1', 'lol'),
'append-item': () => h('p', 'Last item')
},
})
},
}
我尝试使用此帖子中的答案 Vuetify VMenu with render function
我尝试的答案是有效的,但是当我将它应用于自动完成时,它在我尝试过的插槽中对我不起作用。我做错了什么?
答案 0 :(得分:1)
label
不是作用域插槽,您必须这样做:
h(VAutocomplete, [
h('h1', { slot: 'label' }, 'lol')
])