实践
将a标签换成router-link
将href换成to
router-link解析出来就是a标签
![](https://img-blog.csdnimg.cn/direct/59560d24ea2e4d6e82fef9d059d05a42.png)
则可以设置高亮颜色
![](https://img-blog.csdnimg.cn/direct/292d714f15084207b9639e11290d3656.png)
![](https://img-blog.csdnimg.cn/direct/d6a436df0a014ae1ae807db58135b132.png)
总结:
![](https://img-blog.csdnimg.cn/direct/879149ddee424c72b67cc08e64ce3beb.png)
理论:
少了exact就是模糊匹配
![](https://img-blog.csdnimg.cn/direct/6e57b80688c44d12a7696c4f15180c7d.png)
① router-link-active
模糊匹配 (用的多)
to="/my" 可以匹配 /my /my/a /my/b ....
可实现多层高亮,所以一般用的多
② router-link-exact-active
精确匹配
仅可以匹配 /my
其他的都匹配不了
总结:
![](https://img-blog.csdnimg.cn/direct/33ba219f93a14885b54a6cbd8226b86b.png)
![](https://img-blog.csdnimg.cn/direct/4333d348cdf74d0eae8adc69fddd4162.png)
实践:
![](https://img-blog.csdnimg.cn/direct/9bd6ba6a4fe64945ba8840d95aae0814.png)
![](https://img-blog.csdnimg.cn/direct/6659774ad3d0469194d4055f4d844a5b.png)
刚开始长的类名就修改为短的了
![](https://img-blog.csdnimg.cn/direct/d8bc890bdf3942ee857c81cf322e4d22.png)
总结:
![](https://img-blog.csdnimg.cn/direct/c31186512ba84e65a11ad777b53e56ba.png)