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

[Taro3.x] 关于阻止事件冒泡的滚动穿透问题 #7545

Closed
vfiee opened this issue Sep 7, 2020 · 7 comments
Closed

[Taro3.x] 关于阻止事件冒泡的滚动穿透问题 #7545

vfiee opened this issue Sep 7, 2020 · 7 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@vfiee
Copy link

vfiee commented Sep 7, 2020

相关平台

微信小程序

小程序基础库: 2.12.2
使用框架: React

复现步骤

打开微信开发者工具,导入项目代码片段 代码片段

期望结果

阻止父级组件的滚动事件

实际结果

未阻止父级组件的滚动事件

环境信息

Taro CLI 3.0.9 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
      Yarn: 1.22.4 - ~/.yarn/bin/yarn
      npm: 5.1.0 - ~/.config/yarn/global/node_modules/.bin/npm
    npmPackages:
      @tarojs/components: 3.0.9 => 3.0.9 
      @tarojs/mini-runner: 3.0.9 => 3.0.9 
      @tarojs/react: 3.0.9 => 3.0.9 
      @tarojs/runtime: 3.0.9 => 3.0.9 
      @tarojs/taro: 3.0.9 => 3.0.9 
      @tarojs/webpack-runner: 3.0.9 => 3.0.9 
      babel-preset-taro: 3.0.9 => 3.0.9 
      eslint-config-taro: 3.0.9 => 3.0.9 
      react: ^16.10.0 => 16.13.1 

补充信息

看了很多Issue里关于滚动穿透问题解决方案, 1.x版本在事件内部代码体内加入 stopPropagation 会转换为 catch类事件, 但3.x版本编译后的代码很难找到编译结果,希望能有效解决此类问题!

阻止事件冒泡是否可配置的阻止
比如:

onTouchMove={(eve) => {
            eve.stopPropagation();
            // const preventScroll = true;
            // // 根据配置阻止滚动
            // if (preventScroll) {
            //   eve.stopPropagation();
            // }
          }}
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 7, 2020
@vfiee vfiee changed the title [Taro3.x] [Taro3.x] 关于阻止事件冒泡的滚动穿透问题 Sep 7, 2020
@wkh2
Copy link

wkh2 commented Sep 7, 2020

我也遇到这个问题了

@adrien-LD
Copy link

同上,也遇到了这个问题

@caidesen
Copy link

遇到这个问题 +1

@sjmmm
Copy link

sjmmm commented Sep 25, 2020

问题 +1

@wangdanuo
Copy link

问题+1 层主有解决办法了吗?

@abearxiong
Copy link

@Chen-jj
Copy link
Contributor

Chen-jj commented Dec 22, 2020

@Chen-jj Chen-jj closed this as completed Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

8 participants