我想从URL获取路由参数
created() {
this.token = this.getTokenParam();
console.log("Token " + this.token);
}
getTokenParam() : string {
const t = this.$route.params.token
console.log("Token " + this.$route.query.token);
if(t === null) return ''
else
return t;
}
令牌
CfDJ8JrtUPxIgVlCopul3de0MqTwaW1Hukhm9RMfMIsi7kWP / 6u89xVvJ4iAbcWTCTgrYvE9tcqZjYb3QvXrdhNEM2xLT0Ut8jdDDnfa0sKJFDXE8WYZ h5qcDTSb OaohaeEpk8RJXtp sDD3sDTs / gY2xdB3oxQIfnqaTtBoEI / 6C / QtyOGqPW7pWaikG1pRe4uM9j / KDo OWMDwUl tll4CeyM
Token undefined
(为什么未定义?)
答案 0 :(得分:0)
您是从查询参数中读取它吗?
const t = this.$route.query.token
console.log("Token " + this.$route.query.token);