I want to change the color of the navigation icon based on the current route,
But I cannot get the current route in v-if
Hi
- get the current route
app.views.main.router.currentRoute;
- Condition
app.views.main.router.currentRoute.path == 'YOUR_PATH'
this may work !
Thank you for your help
I am using vue.js, I tried your opinion, but still cannot use
Can you give me more help?
Thanks again
<template>
<li :class="{blue: url === '/'}">...</li>
</template>
<script>
export default {
data() {
return {
url: '',
}
},
mounted() {
this.$f7ready((f7) => {
this.url = f7.views.main.router.url;
f7.views.main.on('routeChange', (newRoute) => {
this.url = newRoute.url;
})
})
}
}
</script>
Thanks for your help, the problem is solved,Tribute to friends of f7
1 Like