mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-05 21:53:56 +00:00
3f1d634fb7
* Minor consistency enhancements * Arrow parenthesis consistency * Change linting rule * Fix typo * Update .eslintrc.js to only require parens for blocks * Update style according to brace-only suggestion * Remove --fix from lint * Tweak no-loading time (failing test) * Tweak no-loading time (failing test) (2) * Tweak no-loading time (failing test) (3) * Tweak no-loading time (failing test) (4) * Tweak no-loading time (failing test) (5)
43 lines
914 B
Vue
Executable File
43 lines
914 B
Vue
Executable File
<template>
|
|
<div class="bar-chart">
|
|
<bar-chart :data="barChartData" :options="{ maintainAspectRatio: false }"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import BarChart from '~/components/bar-chart'
|
|
import axios from 'axios'
|
|
import moment from 'moment'
|
|
|
|
export default {
|
|
async asyncData({ env }) {
|
|
const res = await axios.get(`https://api.github.com/repos/nuxt/nuxt.js/stats/commit_activity?access_token=${env.githubToken}`)
|
|
return {
|
|
barChartData: {
|
|
labels: res.data.map(stat => moment(stat.week * 1000).format('GGGG[-W]WW')),
|
|
datasets: [
|
|
{
|
|
label: 'Nuxt.js Commit Activity',
|
|
backgroundColor: '#41b883',
|
|
data: res.data.map(stat => stat.total)
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
components: {
|
|
BarChart
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.bar-chart {
|
|
position: fixed;
|
|
left: 10%;
|
|
top: 10%;
|
|
width: 80%;
|
|
height: 80%;
|
|
}
|
|
</style>
|