watch: {
$route: {
//$route发生变化时执行下面的函数
handler: function (to) {
console.log(to, 'to')
if (to.query.auth_code) {
this.getStaffInfo(to.query.auth_code)
}
const query = to.query
console.log(query, 'query')
if (query) {
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
console.log(this.redirect, 'redirect')
console.log(this.otherQuery, 'otherQuery')
}
},
immediate: true//是否在初始化时就监听变化
}