Last active
June 8, 2018 06:23
-
-
Save dohomi/5c25370de954a33b521574d6935c3ffb to your computer and use it in GitHub Desktop.
data-loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default{ | |
name:"data-loader", | |
extends:ApolloQuery, | |
render(h){ | |
if(isLoading){ | |
return h('v-spinner') | |
}else if(hasError){ | |
return h('v-alert',{},error) | |
}else{ | |
// same logic as in ApolloQuery | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<data-loader :query="query"> | |
<div v-for="result in results"> | |
{{result}} | |
</div> | |
</data-loader> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment