How to create a vuejs3 or nuxt3 component from data loaded from an API

36 Views Asked by At

I'm creating a SPA on Nuxt 3 (ssr: false) that loads data from a Drupal site.

Each "page" of my SPA corresponds to a Drupal page loaded via Drupal JSON API and I can use the v-html directive without problem in my component.

Now I would like to use my html as a real component with reactive data, actions etc. For example interpolating things like <p>Lorem ipsum {{ foo }}</p> or <button @click="bar">Validate</button>

I saw that maybe there was something to do with the defineComponent() or h() functions but I can't do it at all.

Is this possible and if so how? Is there a component or directive that already does this?

Thank you for your help

0

There are 0 best solutions below