clean up the game detail page.
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user