vue项目中总结用到的方法。

依赖 vue-router

获得当前字符串,对应当前路由的路径,总是解析为绝对路径。

  computed: {
    productIcon () {
      return this.imgMap[this.$route.path]
    }
  }

跳转到指定页面 使用router - link to:"/orderList"  可以,注意带/是定位到了根元素

this.$router.push({path: '/orderList'})

 

posted @ 2017-05-07 18:11  铅笔画不出的黑白  阅读(410)  评论(0编辑  收藏  举报