Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Vue warns "provide() can only be used inside setup()" when calling "useSchemaForm()" inside a function. #302

Open
saroshali4 opened this issue Jul 26, 2022 · 0 comments

Comments

@saroshali4
Copy link

saroshali4 commented Jul 26, 2022

Hi, first of all, thanks for the amazing work you've done.
I'm using Vite and Vue3 with composition API style.

Describe the bug
I have a form where user can add multiple contacts, please refer to image.
image

So, what I am trying to achieve is to use "useSchemaForm" to work with dynamic form models. Each tab is an object in the formModel and that object should bind using the "useSchemaForm".

let step = ref(0);
let formModel = ref([{}]);
useSchemaForm(formModel.value[step.value]);

when switching tabs, I'm trying to call "useSchemaForm" inside a function, but it throws the warning.
Vue warn provide() can only be used inside setup().

const selectTab = (index) => { useSchemaForm(formModel.value[index]); };

Expected behavior
It should bind the dynamic form model objects, to achieve these kind of scenarios.

System Info

  • FormVueLate version: 3.9.1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant