How to call a function inside setup from captured event in a composable

34 Views Asked by At

I'm trying to call a function (a function that make a http call and refresh a list of v-cards) inside a component from a composable (that capture an event and modify the reactive variable) through exporting a variable, I'd rather not to use a watcher. here is a sample simplified of the code:

<script setup lang="ts">
import {markedAsStarred} from '....'
//markedAsStarred is the reactive variable exported from the composable
let starredList = ref<any[]>()

function refreshStarredList() {...fill/refresh the starredList...}
</script>
<template>
<childComponent :starredList="starredList"/>
</template>

the target is capture that the markedAsStarred has changed and call refreshStarredList() to pass a new starredList to childComponent

0

There are 0 best solutions below