Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hideLoading后,showLoading不消失 #5230

Closed
linkjd opened this issue Jan 3, 2020 · 4 comments
Closed

hideLoading后,showLoading不消失 #5230

linkjd opened this issue Jan 3, 2020 · 4 comments
Assignees

Comments

@linkjd
Copy link

linkjd commented Jan 3, 2020

问题描述

小米手机存在,在B页面的componentDidShow里边发起了一个网络请求,从A --> B时,loading可以消失,从C返回到B时,loading不消失

复现步骤

小米手机运行该小程序时,当前页面为B页面,从A --> B时,loading会消失,从B --> C,然后从C返回到B时,loading不消失

/**
 * 这段注释后可以贴代码
 * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间
 * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】
 * 
 * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5
 */

componentDidShow() {
    this.getRemainData();
  }

  getRemainData = () => {
    Taro.showLoading();
    Taro.request({
      url: requestRemainUrl,
      method: 'GET'
    }).then((res) => {
      Taro.hideLoading();
      this.setState({
        phoneNumber: res.phone,
        companyName: res.companyName,
        remainingCredit: res.remainingCredit
      }, () => {
        Global.set('phone', this.state.phoneNumber);
        Global.set('companyName', this.state.compact);
        Global.set('remainingCredit', this.state.remainingCredit);
      })
    }).catch((err) => {
      Taro.hideLoading();
      Taro.showToast({
        title: err.message,
        icon: 'none',
        duration: 2000
      })
    })
  };

期望行为

返回该页面时,loading也消失

报错信息

暂无

系统信息

暂无

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Jan 3, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Jan 3, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@linkjd
Copy link
Author

linkjd commented Jan 3, 2020

盼回复,谢谢

@Chen-jj
Copy link
Contributor

Chen-jj commented Jan 3, 2020

@linkjd

  1. onShow 是否触发,hideLoading 是否调用了
  2. B 是否 tab 页
  3. 用 wx.hideLoading 试试
  4. 用 wx.request 试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants