The data is requested before entering the page. I have a requirement here, that is, if the backend code is not equal to 200, it will prompt the user with some error information and prevent the user from entering the next page. After looking at the official website, if you want to interrupt navigation, you can use next(false), but why does it not work if I return false here? Please help.
beforeRouteEnter (to, from, next) {
Vue.$uop.loading.show({
text: '加载中'
})
reqData.req({
apiName: 'getAddress'
}).then((res) => {
next((vm) => {
vm.$uop.loading.hide()
res = res.data
if (res && res.code !== 200) {
vm.$uop.toast.show({
type: 'text',
text: res.message
})
return false // 这里怎么写才能不进入下一个页面
}
})
}).catch((error) => {
Vue.$uop.loading.hide()
Vue.$uop.toast.show({
type: 'text',
text: '请求地址数据异常'
})
})
阿神2017-05-19 10:30:05
return false // How to write here so as not to enter the next page
next(false)
else
next()