mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-17 19:25:13 +00:00
b11e9c0e51
- [ ] babel-eslint https://github.com/babel/babel-eslint/issues/664 - [x] eslint-config-standard-jsx https://github.com/standard/eslint-config-standard-jsx/issues/32 - [x] eslint-config-standard to be stable release https://github.com/standard/eslint-config-standard/issues/123 - [x] eslint-plugin-html - [x] eslint-plugin-import - [x] eslint-plugin-jest - [x] eslint-plugin-node - [x] eslint-plugin-promise - [x] eslint-plugin-standard https://github.com/standard/eslint-plugin-standard/issues/29 - [x] eslint-plugin-vue https://github.com/vuejs/eslint-plugin-vue/pull/504 - [x] eslint-plugin-react https://github.com/yannickcr/eslint-plugin-react/releases/tag/v7.10.0
51 lines
1.1 KiB
Vue
51 lines
1.1 KiB
Vue
<template>
|
|
<div class="doughnut-chart">
|
|
<doughnut-chart :data="doughnutChartData" :options="{ legend: { display: false }, maintainAspectRatio: false }" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import DoughnutChart from '~/components/doughnut-chart'
|
|
import axios from 'axios'
|
|
|
|
function getRandomColor() {
|
|
const letters = '0123456789ABCDEF'
|
|
let color = '#'
|
|
for (let i = 0; i < 6; i++) {
|
|
color += letters[Math.floor(Math.random() * 16)]
|
|
}
|
|
return color
|
|
}
|
|
|
|
export default {
|
|
async asyncData({ env }) {
|
|
const res = await axios.get(`https://api.github.com/repos/nuxt/nuxt.js/stats/contributors?access_token=${env.githubToken}`)
|
|
return {
|
|
doughnutChartData: {
|
|
labels: res.data.map(stat => stat.author.login),
|
|
datasets: [
|
|
{
|
|
label: 'Nuxt.js Contributors',
|
|
backgroundColor: res.data.map(getRandomColor),
|
|
data: res.data.map(() => 1)
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
components: {
|
|
DoughnutChart
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.doughnut-chart {
|
|
position: fixed;
|
|
left: 10%;
|
|
top: 10%;
|
|
width: 80%;
|
|
height: 80%;
|
|
}
|
|
</style>
|