Access slotProps in script setup #8990
Answered
by
Shyam-Chen
fabianwohlfart
asked this question in
Help/Questions
Replies: 1 comment 2 replies
-
<script lang="ts" setup>
function foo({ text, count }) {
return `${text} ${count}`;
}
</script>
<template>
<MyComponent v-slot="slotProps">
{{ foo(slotProps) }}
</MyComponent>
<template> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
fabianwohlfart
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Like here https://vuejs.org/guide/components/slots.html#scoped-slots
<!-- <MyComponent> template --> <div> <slot :text="greetingMessage" :count="1"></slot> </div>
is it possible to access the slotProps in the
<script setup>
?Like so
?
Beta Was this translation helpful? Give feedback.
All reactions