How does vue achieve navigation highlighting?

clipboard.png

as shown in the figure, when you jump to a component, the corresponding left navigation turns red.
the class that controls highlighting is as follows:

.active{
    backgournd-color:yellow;
}

how to achieve it? there is no train of thought at all.

Mar.10,2021

vue-router you can set activeClass , linkActiveClass configure


to get the navigation index, save it, judge whether it is the current navigation according to the index, if yes, add your class


vuex, a global currentNav


official document has, very simple, activeClass

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-1bdbdc5-312ac.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-1bdbdc5-312ac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?