Taro: 如何只在 h5 中关闭下拉刷新

Created on 29 Oct 2019  ·  9Comments  ·  Source: NervJS/taro

问题描述

在微信中,我想正常使用下拉刷新功能,但在 h5 中因为下拉刷新体验不太好,准备禁用(下拉刷新的包装影响了 position: fixed 样式),但是 enablePullDownRefresh 在 h5 中并没有起作用。

在 h5 中,貌似只要有 onPullDownRefresh 方法就自动包裹了下拉刷新?这样就没法通过判断 env 来禁用了。

复现步骤

  1. 创建一个下拉刷新的页面
  2. 查看 h5

系统信息

Taro v1.3.22


  Taro CLI 1.3.22 environment info:
    System:
      OS: macOS 10.15
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node
      Yarn: 1.7.0 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v10.14.1/bin/npm
    npmPackages:
      @tarojs/async-await: 1.3.22 => 1.3.18
      @tarojs/components: 1.3.22 => 1.3.22
      @tarojs/mobx: 1.3.22 => 1.3.18
      @tarojs/mobx-h5: 1.3.22 => 1.3.18
      @tarojs/mobx-rn: 1.3.22 => 1.3.18
      @tarojs/plugin-babel: 1.3.22 => 1.3.18
      @tarojs/plugin-csso: 1.3.22 => 1.3.18
      @tarojs/plugin-sass: 1.3.22 => 1.3.22
      @tarojs/plugin-uglifyjs: 1.3.22 => 1.3.18
      @tarojs/rn-runner: 1.3.22 => 1.3.18
      @tarojs/router: 1.3.22 => 1.3.18
      @tarojs/taro: 1.3.22 => 1.3.22
      @tarojs/taro-alipay: 1.3.22 => 1.3.18
      @tarojs/taro-h5: 1.3.22 => 1.3.18
      @tarojs/taro-swan: 1.3.22 => 1.3.18
      @tarojs/taro-tt: 1.3.22 => 1.3.18
      @tarojs/taro-weapp: 1.3.22 => 1.3.18
      @tarojs/webpack-runner: 1.3.22 => 1.3.22
      eslint-config-taro: 1.3.22 => 1.3.18
      eslint-plugin-taro: 1.3.22 => 1.3.18
      nerv-devtools: ^1.5.2 => 1.5.1
      nervjs: ^1.5.2 => 1.5.1
      stylelint-config-taro-rn: 1.3.22 => 1.3.18
      stylelint-taro-rn: 1.3.22 => 1.3.18
question

Most helpful comment

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

All 9 comments

欢迎提交 Issue~

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

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

Good luck and happy coding~

Duplicate of #3285

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

请问 问题解决了 现在我也是h5下拉刷新 影响fixed

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

可用 simplify 成 enablePullDownRefresh: process.env.TARO_ENV !== 'h5'

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

可用 simplify 成 enablePullDownRefresh: process.env.TARO_ENV !== 'h5'

这样设置好像没有用耶

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

设置了没用,只要设置了onPullDownRefresh() {} 这个方法,下拉刷新就会生效的

enablePullDownRefresh: process.env.TARO_ENV === 'h5' ? false : true

设置了没用,只要设置了onPullDownRefresh() {} 这个方法,下拉刷新就会生效的

兄dei有解决方案吗

1.h5下直接onPullDownRefresh = null
2.两端使用不同的pages

Was this page helpful?
0 / 5 - 0 ratings