In vue-cli, how to add a class to an element of the page to change the style according to the natural route as a condition.

now you need to change the style of an element on the page based on the current route when the page jumps to a route.
Boss, don"t just talk about ideas, but also talk about the specific implementation code. I am relatively bad, a lot of grammar is not very familiar with, please!

Mar.05,2021

 routeName:this.$route.name,
:class="{'active':routeActive==='home'}"
  1. get the name of the current route;
  2. bind with vue style;
  3. just write the style according to this active

extract this part of the function into a component, then use watch to listen for routing changes, and then set the component style according to the style of each route you want to use

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e7cdf5-466ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e7cdf5-466ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?