Read slot data in component

Hello,
I want to pass data to component using slot, however I would like to also access data in methods.

<custom-component>
<slot name="data"></slot>
<other-component :prop="dataFromSlot"></other-component>
</custom-component>
...
computed:{
dataFromSlot:{
return `altered${$slot.data}1
}
..

  <div>
 <custom-component><template v-slot="data">custom string</template></custom-component>
</div>

Is that possible ?

yes it is possible to access the slot data passed from parent and pass it to another nested component using following vue instance property

$slots

you can do something like this:

computed:{
  dataFromSlot:{
    return this.$slot.data[0].text
  }
}

i hope this helps