We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to get a dynamic title for useMeta with composition API but it does not work.
<script setup> import { computed } from 'vue' import { POST } from '@/constants/blog' import { useQuery, useResult } from "@vue/apollo-composable"; import { useRoute } from 'vue-router' import { useMeta } from "vue-meta"; const route = useRoute(); const variables = computed(() => ({ slug: route.params.slug, })); const { result, loading, error } = useQuery( POST, variables ); const post = useResult(result, null, data => data.post.data ); const metaTitle = computed(() => ({ title: post.attributes.title, })); useMeta(metaTitle); </script>
Here is the response
{ "data": { "post": { "data": { "id": 4, "attributes": { "title": "This is the post title" } } } } }
Please help me understand what is wrong here!
The text was updated successfully, but these errors were encountered:
I am trying to get a dynamic title for useMeta with composition API but it does not work. <script setup> import { computed } from 'vue' import { POST } from '@/constants/blog' import { useQuery, useResult } from "@vue/apollo-composable"; import { useRoute } from 'vue-router' import { useMeta } from "vue-meta"; const route = useRoute(); const variables = computed(() => ({ slug: route.params.slug, })); const { result, loading, error } = useQuery( POST, variables ); const post = useResult(result, null, data => data.post.data ); const metaTitle = computed(() => ({ title: post.attributes.title, })); useMeta(metaTitle); </script> Here is the response { "data": { "post": { "data": { "id": 4, "attributes": { "title": "This is the post title" } } } } } Please help me understand what is wrong here!
You should use the correct computed for this case. Try to add data here
const metaTitle = computed(() => ({ title: post.data.attributes.title, }));
Sorry, something went wrong.
No branches or pull requests
I am trying to get a dynamic title for useMeta with composition API but it does not work.
Here is the response
Please help me understand what is wrong here!
The text was updated successfully, but these errors were encountered: