Skip to content

Instantly share code, notes, and snippets.

@djmtype
Created July 26, 2020 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djmtype/cc98ce1a62e77101d41f215db7c9e521 to your computer and use it in GitHub Desktop.
Save djmtype/cc98ce1a62e77101d41f215db7c9e521 to your computer and use it in GitHub Desktop.
Spotify Gridsome
<template>
<div>
<h1 v-html="$page.oneGraph.spotify.me.id" />
<ul>
<li v-for="(item, index) in $page.oneGraph.spotify.me.playlists" :key="index">
<g-link :to="item.externalUrls.spotify">{{item.name}}</g-link>
<img :src="item.images[0].url" :height="300" :width="300" />
</li>
</ul>
</div>
</template>
<page-query>
{
oneGraph {
spotify {
me {
id
playlists(limit: 10) {
id
name
images {
url
height
width
}
externalUrls {
spotify
}
tracks {
id
name
durationMs
artists {
id
name
}
}
}
}
}
}
}
</page-query>
<script>
export default {
metaInfo: {
title: 'Hello, world!'
}
}
</script>
<style>
li {
margin-bottom: 1.5rem;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment