-1👍
The valueOf method is not appropriate for this purpose. A GraphQL schema document does not provide direct access to its queries, mutations, or subscriptions through a key-value pair access method.
First, ensure you have installed the graphql-tag package in your project:
npm install graphql-tag
Define your queries in schema.gql:
query AllUsers {
allUsers {
nodes {
id
name
# other fields...
}
}
}
import and use the AllUsers query in your component:
<script setup>
import { useQuery } from "@vue/apollo-composable";
import { loader } from "graphql.macro";
const Schema = loader('@/graphql/schema.gql');
const { result } = useQuery({
query: Schema.AllUsers
});
// Here, 'result' will contain your fetched data when available.
</script>
Hope this helps!
- [Vuejs]-Show child component when promise data is exists and also render the data in child omponent
- [Vuejs]-CSS Positioning of Input and Dropdown in Data Table
Source:stackexchange.com