xinggevip

Vue2.x Cli3.x优化router-link标签(tag、redirect)
更改router-link默认编译的a标签为制定标签<router-link tag="div&q...
扫描右侧二维码阅读全文
26
2019/05

Vue2.x Cli3.x优化router-link标签(tag、redirect)

更改router-link默认编译的a标签为制定标签

<router-link tag="div" to="/">主页</router-link>

动态绑定路由地址

<router-link :to="homelink" class="nav-link">主页</router-link>

<script>
export default {
    data(){
        return{
            homelink:'/',
        }
    }
}
</script>

默认路由redirect

{
      // 当路由匹配不到以上路由地址的时候,自动匹配到制定路由地址
      path:"*",
      redirect:'/'
}
Last modification:May 26th, 2019 at 02:27 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment