[Vuejs]-Convert vuejs mixin to vue3 composition API

0👍

defineProps is not composition API but a macro for script setup syntax that compiles to props option, it cannot be used in a composable.

In case a prop is reactive and can change over time, it needs to be passed as a computed to the composable:

function useComp(field, formValues) {
  ...
        try {
          console.log("showExpression ", unref(formValues));
          ...
        } catch (e) {
          console.error("Please fix expression ", unref(field).showIf, "for ", unref(field).key);
          ...
        }
  ...
}

And used like:

useComp(computed(() => props.field), computed(() => props.formValues))

Leave a comment