Having an issue where I am attempting to pass a component prop to a composable, but the computed function within the composable is not being called when the prop changes.
import { toRefs } from 'vue';
export default {
props: {
aProp: String,
},
setup(props) {
// Having trouble with this code segment
const { aProp } = toRefs(props);
const { aHasChanged } = useA(aProp);
return {
aHasChanged,
};
},
};
Here's the composable code:
import { computed } from 'vue';
function useComposable(aProp) {
const aHasChanged = computed(() => {
return aProp === '';
});
return {
aHasChanged,
};
}
export { useComposable };
Check out the example on StackBlitz: https://stackblitz.com/edit/github-yfh8fb-xaspss?file=composables%2Fa.js