Coder Social home page Coder Social logo

Comments (8)

stackjie avatar stackjie commented on June 1, 2024

通过vue ref拿到组件实例然后调用组件内部的scrollTo方法

from vue-pull-to.

stackjie avatar stackjie commented on June 1, 2024

scrollTo(y, duration = 200) 这是参数

from vue-pull-to.

acmeid avatar acmeid commented on June 1, 2024

非常感谢!

from vue-pull-to.

acmeid avatar acmeid commented on June 1, 2024

@stackjie 好像还是不行
this.$refs['pul-ell'].scrollTo(0,0) 这样写没能返回顶部,我发现第一个参数y实际效果是pull-to组件的整体偏移

vue: 2.5.13
vue-pull-to: 0.1.6
chrome: 64.0.3282.186(正式版本) (64 位)

from vue-pull-to.

F-loat avatar F-loat commented on June 1, 2024

这样可以 document.querySelector('.scroll-container').scrollTop = scrollTop

from vue-pull-to.

acmeid avatar acmeid commented on June 1, 2024

好的,谢谢!

from vue-pull-to.

bowencool avatar bowencool commented on June 1, 2024

scrollTo没有用。。
提个建议:
集成backToTop功能。同样使用slot定义结构,自动判断按钮显隐性。

from vue-pull-to.

BNC123 avatar BNC123 commented on June 1, 2024

document.querySelector('.scroll-container').scrollTop = scrollTop 这样好像不行,scrollTo也不可以。 @acmeid ,请问你之前做的可以吗?

from vue-pull-to.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.