반응형
Vue 2 렌더 기능에서 슬롯을 사용하는 방법
다음을 하고 싶은데 Vue 2의 렌더링 기능을 사용하여
<template>
<imported-component>
<template v-slot:default="{ importedFunction }">
<button @click="importedFunction">Do something</button>
</template>
</import-component>
</template>
scopedSlots
- 슬롯 소품에는 slot name(기본값) + function 인수를 사용합니다.
on
의 경우
render(h) {
return h('imported-component', {
scopedSlots: {
default(slotProps) {
return h('button', {
on: {
click: slotProps.importedFunction
}
}, 'Do something')
}
}
});
}
언급URL : https://stackoverflow.com/questions/65662621/how-to-use-slot-in-vue-2-render-function
반응형
'programing' 카테고리의 다른 글
로그인 명령 구현 및 vuex 스토어 액세스 (0) | 2022.07.18 |
---|---|
Vuex getter가 유형 오류를 표시함 " is not function" (0) | 2022.07.18 |
Vuelidate - 변환 핸들러 외부의 vuex 저장소 상태 변환 안 함 (0) | 2022.07.18 |
Vuex 및 vuex-module-decorator에서 작동하는 정적 모듈을 로드할 수 없습니다. (0) | 2022.07.18 |
Java에서 목록을 세트로 변환하는 가장 쉬운 방법 (0) | 2022.07.18 |