mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
refactor: watch vue router changes with $route
This commit is contained in:
parent
d77ade8156
commit
594c45f519
1 changed files with 4 additions and 15 deletions
|
|
@ -107,8 +107,8 @@
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- View -->
|
|
||||||
|
|
||||||
|
<!-- View -->
|
||||||
<transition :name="tabTransition">
|
<transition :name="tabTransition">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
@ -150,15 +150,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
summoner() {
|
|
||||||
return this.$route.params.name
|
|
||||||
},
|
|
||||||
region() {
|
|
||||||
return this.$route.params.region
|
|
||||||
},
|
|
||||||
uri() {
|
|
||||||
return `${this.summoner}|${this.region}`
|
|
||||||
},
|
|
||||||
tabTransition() {
|
tabTransition() {
|
||||||
return this.summonerFound && this.overviewLoaded ? 'tab' : 'none'
|
return this.summonerFound && this.overviewLoaded ? 'tab' : 'none'
|
||||||
},
|
},
|
||||||
|
|
@ -169,21 +160,19 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
uri() {
|
$route() {
|
||||||
console.log('route changed')
|
|
||||||
this.updateSettings({ name: 'region', value: this.region.toLowerCase() })
|
|
||||||
this.apiCall()
|
this.apiCall()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.updateSettings({ name: 'region', value: this.region.toLowerCase() })
|
|
||||||
this.apiCall()
|
this.apiCall()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
apiCall() {
|
apiCall() {
|
||||||
this.basicRequest({ summoner: this.summoner, region: this.region })
|
this.updateSettings({ name: 'region', value: this.$route.params.region.toLowerCase() })
|
||||||
|
this.basicRequest({ summoner: this.$route.params.name, region: this.$route.params.region })
|
||||||
},
|
},
|
||||||
isRouteActive(currentRoute) {
|
isRouteActive(currentRoute) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue