注意:在视图层使用把this去掉,使用“Mustache”语法 (双大括号) 的文本插值
如:{{$route.params.id}}
完整路径:
window.location.href
路由路径:
this.$route.path
路由路径参数
this.$route.params
/user/:id → /user/12
this.$route.params.id;//12
本文介绍了在Vue.js中如何使用Mustache语法进行文本插值,以及如何获取和使用路由参数。通过具体示例,展示了如何在视图层正确地显示路由传入的参数。
注意:在视图层使用把this去掉,使用“Mustache”语法 (双大括号) 的文本插值
如:{{$route.params.id}}
完整路径:
window.location.href
路由路径:
this.$route.path
路由路径参数
this.$route.params
/user/:id → /user/12
this.$route.params.id;//12
2990
1857

被折叠的 条评论
为什么被折叠?