Added argument and typelink components for GraphQL
This commit is contained in:
44
components/graphql/argument.vue
Normal file
44
components/graphql/argument.vue
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<span>
|
||||||
|
<span class="argumentName">
|
||||||
|
{{ argName }}
|
||||||
|
</span>
|
||||||
|
:
|
||||||
|
<typelink
|
||||||
|
:type="argType"
|
||||||
|
:jumpTypeCallback="jumpCallback"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import typelink from './typelink';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
typelink: typelink
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
gqlArg: Object
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
argName() {
|
||||||
|
return this.gqlArg.name;
|
||||||
|
},
|
||||||
|
argType() {
|
||||||
|
return this.gqlArg.type;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
jumpCallback(typeName) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
33
components/graphql/typelink.vue
Normal file
33
components/graphql/typelink.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<span class="typelink" @click="jumpToType">{{ typeString }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.typelink {
|
||||||
|
color: red
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
gqlType: null,
|
||||||
|
|
||||||
|
// (typeName: string) => void
|
||||||
|
jumpTypeCallback: Function
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
typeString() {
|
||||||
|
return this.gqlType.toString();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
jumpToType() {
|
||||||
|
this.jumpTypeCallback(this.gqlType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
Reference in New Issue
Block a user