vue项目中总结用到的方法。
依赖 vue-router
获得当前字符串,对应当前路由的路径,总是解析为绝对路径。
computed: {
productIcon () {
return this.imgMap[this.$route.path]
}
}
跳转到指定页面 使用router - link to:"/orderList" 可以,注意带/是定位到了根元素
this.$router.push({path: '/orderList'})
依赖 vue-router
获得当前字符串,对应当前路由的路径,总是解析为绝对路径。
computed: {
productIcon () {
return this.imgMap[this.$route.path]
}
}
跳转到指定页面 使用router - link to:"/orderList" 可以,注意带/是定位到了根元素
this.$router.push({path: '/orderList'})