首页 > 其他分享 >如何处理异步调用

如何处理异步调用

时间:2022-12-21 13:11:06浏览次数:31  
标签:异步 调用 用户注册 处理 phone code result && password

  //用户注册
    async uerRegister({commit},user){
        let result=await reqUserRegister(user);
             console.log(result)
            if (result.code==200) {
                return 'ok'
            } else {
                return Promise.reject(new Error('fail'));
            }
        }
 //用户注册
      async userRegister(){
       const {phone,code,password,password1} =this;

       try {
        //如果成功路由跳转
        password==password1 && phone &&code&&await this.$store.dispatch('uerRegister',{phone,code,password})
        this.$router.push('/login')
       } catch (error) {
        
        alert(error.message)
       }
      
      
      }

 

标签:异步,调用,用户注册,处理,phone,code,result,&&,password
From: https://www.cnblogs.com/xiaobaizitaibai/p/16996018.html

相关文章