Skip to content

usePageContent

loadComponent

usePageContent

Composable for fetching and managing CMS-driven tab page content. Handles fetching tabs from a Strapi endpoint, dynamically loading any Vue components referenced in tab data, and keeping the active tab in sync with the URL query parameter ?tab=.

Parameters:

  • apiUrl: - The full API URL to fetch page content from.
  • filterFn: - Optional function (tabs) => tabs applied after fetching, before components are loaded. Use this to filter or reorder tabs based on runtime conditions (e.g. user role).
  • options:
  • options.autoMount: - When true, getPageContent is called automatically via onMounted. Set to false when the calling page needs to await getPageContent() before performing additional work in its own onMounted.

Returns:

getPageContent

Nested in: usePageContent

Released under the MIT License.