added router-links for scoreboard-nav

This commit is contained in:
cnachtigall1991
2021-10-11 14:44:50 +02:00
parent f3169572c8
commit 76aba61361
2 changed files with 18 additions and 3 deletions

View File

@@ -26,7 +26,8 @@ const routes = [
path: '/match/:match_id',
name: 'Match',
component: lazyLoad('Match'),
props: true
props: true,
alias: ['/match/:match_id/flashes', '/match/:match_id/utility']
},
{
path: '/explore',

View File

@@ -38,7 +38,6 @@
<li class="list-item scoreboard active" @click.prevent="ActivateScoreInfo('scoreboard')">Scoreboard</li>
<li class="list-item flashes" @click.prevent="ActivateScoreInfo('flashes')">Flashes</li>
<li class="list-item utility" @click.prevent="ActivateScoreInfo('utility')">Utility</li>
<li class="list-item damage" @click.prevent="ActivateScoreInfo('damage')">Damage</li>
</ul>
</div>
</div>
@@ -82,9 +81,10 @@
</template>
<script>
import {defineAsyncComponent, onBeforeMount, reactive, watch} from "vue";
import {defineAsyncComponent, onBeforeMount, onMounted, reactive, watch} from "vue";
import axios from 'axios'
import {DisplayRank, FormatFullDate, GetHLTV_1, GoToPlayer, LoadImage} from "../utils";
import router from "../router";
const ScoreTeam = defineAsyncComponent(() => import('../components/ScoreTeam'))
const FlashChart = defineAsyncComponent(() => import('../components/FlashChart'))
@@ -155,6 +155,12 @@ export default {
newNavItem.classList.add('active')
newItem.classList.add('active')
if (id === 'flashes' || id === 'utility'){
history.pushState({}, null, `/match/${data.matchDetails.match_id}/${id}`)
} else if (id === 'scoreboard') {
history.pushState({}, null, `/match/${data.matchDetails.match_id}`)
}
}
// Watchers
@@ -166,6 +172,14 @@ export default {
GetMatch()
})
onMounted(() => {
if (router.currentRoute.value.href.split('/')[3]) {
setTimeout(() => {
ActivateScoreInfo(router.currentRoute.value.href.split('/')[3])
}, 500)
}
})
return {
GetMatch, GetAvgRank, ActivateScoreInfo, data, GoToPlayer, GetHLTV_1, DisplayRank, FormatFullDate, LoadImage
}