亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How does vue not go to the next page if the code is not equal to 200 after requesting data before entering the next page?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-19 10:28:05
0
1
653

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 // 這里怎么寫才能不進(jìn)入下一個(gè)頁面
            }
          })
        }).catch((error) => {
          Vue.$uop.loading.hide()
          Vue.$uop.toast.show({
            type: 'text',
            text: '請求地址數(shù)據(jù)異常'
          })
        })
PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級PHP講師

reply all(1)
阿神

return false // How to write here so as not to enter the next page

next(false)

else

next()

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template