Giter VIP home page Giter VIP logo

Comments (13)

Thinking80s avatar Thinking80s commented on June 12, 2024

mark

from ddfe-blog.

LeungKaMing avatar LeungKaMing commented on June 12, 2024

谢谢作者对better-scroll结合vue做的剖析,之前模仿饿了么项目的时候用到该插件,一直不明白为什么要在this.$nextTick里面去初始化better-scroll。。现在算是懂了。。。

from ddfe-blog.

huandu avatar huandu commented on June 12, 2024

我在想,用全局 directive 实现是不是更简洁呢?毕竟 html 里面本来没有 scroll view 这种概念,所有 block level elements 本身都可以通过 overflow 样式来控制是否能够 scroll,如果实现一个 boolean 值的全局 directive 来控制是否在某个元素上面启用 better-scroll 似乎更加自然一些,使用者只需要一个属性就能工作。实现这个 directive 的时候可以考虑监听 component updated 来自动异步 refresh,这样对使用者就更加没有负担了。

from ddfe-blog.

ustbhuangyi avatar ustbhuangyi commented on June 12, 2024

@huandu 欢总来评论了,倍感荣幸。其实我认为不管是 directive 还是 component,都是一个语法糖,本质上还是对 better-scroll 做了一层封装。从易用性上讲,2者差别不大(组件的话也就是把 div 标签换成了 scroll 标签)。从传参方面,指令的传参看上去很蹩脚,而组件通过 props 来控制 scroll 组件的能力,似乎更 make sense 喔。还有一点,组件可以暴露一些方法给外部调用,也就是父组件可以通过调用子组件方法来控制它的行为,这点指令似乎不好搞吧~

from ddfe-blog.

sfyr111 avatar sfyr111 commented on June 12, 2024

better-scroll配合sortable使用会出现拖拽元素阴影错位的情况,问题发生在better-scroll在初始化后。拖拽使用了vuedraggable

from ddfe-blog.

rainwalkerhu avatar rainwalkerhu commented on June 12, 2024

这个做下拉刷新怎么让顶部先弹回去呢,等到请求数据的时候再弹下来显示加载动画

from ddfe-blog.

ustbhuangyi avatar ustbhuangyi commented on June 12, 2024

@rainwalkerhu 参考最新的 demo 吧
https://ustbhuangyi.github.io/better-scroll/demo/#/vertical-scroll

from ddfe-blog.

tanyewei avatar tanyewei commented on June 12, 2024
        // 是否派发顶部下拉事件,用于下拉刷新
        if (this.pulldown) {
          this.scroll.on('touchend', (pos) => {
            // 下拉动作
            if (pos.y > 50) {
              this.$emit('pulldown')
            }
          })
        }

忽略。。。 touchend -> touchEnd

from ddfe-blog.

Jenny-O avatar Jenny-O commented on June 12, 2024

666,感谢分享干货,已推荐到 SegmentFault 头条 (๑•̀ㅂ•́)و✧
链接如下:https://segmentfault.com/p/1210000011520834

from ddfe-blog.

mcfly001 avatar mcfly001 commented on June 12, 2024

请问 slot 插槽 里面scrollToElement scrollTo的方法怎么调用?都是需要通过在父组件里面绑定一个值,然后在子组件里面添加watch方法去监听,然后调用么?

from ddfe-blog.

ustbhuangyi avatar ustbhuangyi commented on June 12, 2024

@mcfly001 , 可以参考 https://github.com/ustbhuangyi/better-scroll/blob/master/example/components/scroll/scroll.vue

from ddfe-blog.

mcfly001 avatar mcfly001 commented on June 12, 2024

谢谢, 这插件功能确实很强大,打算把vue-swiper分页也换过来了

from ddfe-blog.

zhayes avatar zhayes commented on June 12, 2024

v-show 的时候滚动无效,然后我监听了控制显示隐藏的字段,在里面进行刷新,但还是不能滚动!
image

from ddfe-blog.

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.