Skip to content

Conversation

@ccpend
Copy link

@ccpend ccpend commented May 20, 2015

No description provided.

@hax
Copy link

hax commented May 20, 2015

没看懂。。。

如果只是解决重复绑定,为啥不是在hide里解绑?

@ccpend
Copy link
Author

ccpend commented May 20, 2015

如果在hide中解绑,需要额外设置事件的命名空间。
存在多个modal同时show的情况就很难把控,且会在window上多次绑定scroll与resize事件

@hax
Copy link

hax commented May 20, 2015

额外设置这个不觉得是问题。

不过多modal是个问题。现在是可以多modal的吗?我个人觉得多modal本身似乎应该不允许才对。而且现有实现似乎也没考虑过多modal,比如遮罩也只有一个。

@amio
Copy link
Contributor

amio commented May 20, 2015

  • 在 hide 中解绑的话,可以在绑定时候把 modal 闭包一下传给函数,就不用额外设置命名空间了
  • 按目前的方案,把所有操作都封装到 setPos() 里更清楚些。分散在几个地方配合实现,可读性略受影响
  • 目前没有解绑操作,that.setPos(that.$element); 这里引用的 $element 是个内存泄露点

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

Successfully merging this pull request may close these issues.

3 participants