With the nuxt-3 compatible version of nuxtjs-drupal-ce (2.x branch) we want to move to JSON based rendering by default, since it has:
Better DX
Better page-load performance since no template-compilation is needed during run-time
Nuxt3 currently has an open issue that configure the full-vue build is not working
The JSON output will work the same for props, but rendering slots requires some little code.
Here is a render function that works with nuxt3/vue3:
/**
* Render elements from page data returned from useDrupalCeFetchPage
* @param customElement
*/
export const useDrupalCeRenderCustomElements = (customElement) => {
return h(resolveComponent(customElement.element), customElement)
}
With the nuxt-3 compatible version of nuxtjs-drupal-ce (2.x branch) we want to move to JSON based rendering by default, since it has:
The JSON output will work the same for props, but rendering slots requires some little code.
Here is a render function that works with nuxt3/vue3:
see usage at https://github.com/drunomics/nuxtjs-drupal-ce/pull/99/files#diff-5cfc0be424c6459b85448814081e0b5b51be314f128a9fcbab458e06d1b56e33R75
Then components having a slot, e.g. "body" would have to use it like that:
for scaffolded componets I could see use doing vue-components that work with both markup and json, by using the json output as the slot fallback:
We should be able to do the same with Vue2 / nuxt-2.x, so we could allow rendering from JSON there as well.