Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

同一个页面多个Pull to refreh 组件 #617

Open
JZhangjie opened this issue Nov 27, 2019 · 0 comments
Open

同一个页面多个Pull to refreh 组件 #617

JZhangjie opened this issue Nov 27, 2019 · 0 comments

Comments

@JZhangjie
Copy link

Pull to refreh组件,同一个页面有使用多个时,初始化后的回调函数会被覆盖。
是PTR 的构造函数中,this.opt = $.extend(PTR.defaults, opt || {}); 导致所有的PTR对象的opt属性指向了同一个。如下修改:
this.opt = $.extend( opt || {},PTR.defaults,);

  var PTR = function(el, opt) {
    if (typeof opt === typeof function () {}) {
      opt = {
        onRefresh: opt
      }
    }
    if (typeof opt === typeof 'a') {
      opt = undefined
    }
    this.opt = $.extend(PTR.defaults, opt || {});
    this.container = $(el);
    this.attachEvents();
  }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant