用数组的解构分别获取路由中的某一个字段 王远祥 2020-09-30 138 阅读1分钟 const path = '/foo/bar/baz' const [ , first,center,last] = path.split('/') console.log(first,center,last) // foo bar baz