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

Taro.pageScrollTo(param) H5中无效 #5262

Closed
giantss opened this issue Jan 7, 2020 · 7 comments
Closed

Taro.pageScrollTo(param) H5中无效 #5262

giantss opened this issue Jan 7, 2020 · 7 comments
Assignees

Comments

@giantss
Copy link

giantss commented Jan 7, 2020

点击按钮没有任何效果,控制台也没有任何报错。。。

复现代码

/**
 * Created by zhongpeng on 2019/6/5.
 */
import Taro, {Component} from '@tarojs/taro'
import {
  View,
  ScrollView,
  Swiper,
  SwiperItem
} from '@tarojs/components'
import './index.scss'
import {
  AtButton,

} from 'taro-ui'
import {screenHeight, screenWidth} from "../../commom/Global";

export default class Demo extends Component {
  constructor() {
    super(...arguments);

  }

  config = {
    navigationBarTitleText: 'demo'
  }

  componentDidMount(){

  }

  onClickBtn = () => {
    Taro.pageScrollTo({
      scrollTop: 800,
      duration: 300
    })
  }


  render() {

    return (
      <ScrollView
        style={{width: screenWidth, height: screenHeight}}
        scrollY>
        <Swiper
          circular
          interval="3000"
          style={{width: screenWidth, height: screenWidth}}
          indicatorDots
          autoplay
        >
          {
            [1,2,3].map((item, i)=>{

              return (
                <SwiperItem style={{height: 30}}>
                  {item}
                </SwiperItem>
              )
            })
          }
        </Swiper>
        <View style={{height: 1200}}>

        </View>
        <AtButton
          onClick={this.onClickBtn}
          customStyle={{position: 'fixed', bottom: 0}}
        >测试按钮</AtButton>
      </ScrollView>

    )
  }
}

环境

 Taro CLI 1.3.34 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.13.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    npmPackages:
      @tarojs/async-await: 1.3.34 => 1.3.34 
      @tarojs/components: 1.3.34 => 1.3.34 
      @tarojs/plugin-babel: 1.3.34 => 1.3.34 
      @tarojs/plugin-csso: 1.3.34 => 1.3.34 
      @tarojs/plugin-sass: 1.3.34 => 1.3.34 
      @tarojs/plugin-uglifyjs: 1.3.34 => 1.3.34 
      @tarojs/router: 1.3.34 => 1.3.34 
      @tarojs/taro: 1.3.34 => 1.3.34 
      @tarojs/taro-alipay: 1.3.34 => 1.3.34 
      @tarojs/taro-h5: 1.3.34 => 1.3.34 
      @tarojs/taro-swan: 1.3.34 => 1.3.34 
      @tarojs/taro-tt: 1.3.34 => 1.3.34 
      @tarojs/taro-weapp: 1.3.34 => 1.3.34 
      @tarojs/webpack-runner: 1.3.34 => 1.3.34 
      eslint-config-taro: 1.3.34 => 1.3.34 
      eslint-plugin-taro: 1.3.34 => 1.3.34 
      nerv-devtools: ^1.5.6 => 1.5.6 
      nervjs: ^1.5.6 => 1.5.6 
      stylelint-config-taro-rn: 1.3.34 => 1.3.34 
      stylelint-taro-rn: 1.3.34 => 1.3.34 
    npmGlobalPackages:
      typescript: 3.7.3

@taro-bot
Copy link

taro-bot bot commented Jan 7, 2020

CC @Littly

@taro-bot
Copy link

taro-bot bot commented Jan 7, 2020

欢迎提交 Issue~

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

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

Good luck and happy coding~

@Littly
Copy link
Contributor

Littly commented Jan 7, 2020

Taro找不到页面中需要滚动的元素,需要手动处理下

@giantss
Copy link
Author

giantss commented Jan 7, 2020

@Littly 怎么处理。。

@WsmDyj
Copy link

WsmDyj commented Jan 14, 2020

大哥们,解决了吗

@littcc
Copy link

littcc commented Aug 13, 2020

Taro找不到页面中需要滚动的元素,需要手动处理下

??? 神回复,
执行成功,但是没有任何反应

@ZakaryCode
Copy link
Contributor

Taro找不到页面中需要滚动的元素,需要手动处理下

??? 神回复,
执行成功,但是没有任何反应

说的是 ScrollView 里的需要手动处理,和 pageScrollTo 方法没有关系,ScrollView 构建的页面本来就没有超出页面高度,pageScrollTo 只是用于控制页面级的滚动。

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

5 participants