clean up the game detail page.

This commit is contained in:
iamBadgers
2024-05-25 12:00:02 -07:00
parent e62825a114
commit 04a6e47a0a
7 changed files with 125 additions and 57 deletions

View File

@@ -96,6 +96,9 @@ import { onMounted, watch, ref } from 'vue'
import Chart from 'chart.js/auto'
import axios from 'axios'
const route = useRoute()
const router = useRouter()
const dateSelect = ref(-1)
const dateItems = buildDateItems()
@@ -184,6 +187,7 @@ function updateChart(stats, tag) {
}
watch(dateSelect, async (newValue, oldValue) => {
router.replace({ query: { monthId: dateSelect.value } })
loadData()
})
@@ -196,6 +200,12 @@ watch(chartSelect, async (newValue, oldValue) => {
})
onMounted(async () => {
console.log(dateItems)
if (!route.query.monthId) {
router.replace({ query: { monthId: -1 } })
} else {
dateSelect.value = Number(route.query.monthId)
}
loadData()
chart = new Chart(document.getElementById('piechart'), {
type: 'pie',