关于router-link的简单使用

<router-link tag="li" to="/home">
                <img src="@/assets/movie.png" alt>
                <p>电影</p>
            </router-link>
            <router-link tag="li" to="/city">
                  <img src="@/assets/CityHall.png" alt>
                 <p>城市</p>
            </router-link>
            <router-link tag="li" to="/person">
                <img src="@/assets/personal.png" alt>
                 <p>个人中心</p>
            </router-link>

其中的tag为要渲染成什么标签,to为要跳转的路由页

也可以通过to进行传参,接受方式参考https://www.cnblogs.com/lipu12281/p/11852024.html

<router-link tag="li" to="{name:"home",params:{id:1}}">
                <img src="@/assets/movie.png" alt>
                <p>电影</p>
            </router-link>
            <router-link tag="li" to="/city">
                  <img src="@/assets/CityHall.png" alt>
                 <p>城市</p>
            </router-link>
            <router-link tag="li" to="/person">
                <img src="@/assets/personal.png" alt>
                 <p>个人中心</p>
            </router-link>
router-link-active属性,触发时会激活
.router-link-active{
    color: blue;
}

 

 

 

posted @ 2019-11-11 18:11  lipu1993  阅读(495)  评论(0编辑  收藏  举报