BosNaufal / vue-scrollbar

The Simplest Scroll Area Component with custom scrollbar for Vue Js. https://bosnaufal.github.io/vue-scrollbar/
MIT License
117 stars 25 forks source link

How could I fix this #1

Closed yoonge closed 7 years ago

yoonge commented 8 years ago

First time I route to the vue-scrollbar using page, it works perfectly for me. But if I route to the other page, and then route back to the vue-scrollbar using page and click anywhere, the following error occurs:

qq 20160521083651 And this is my dependencies list:

"dependencies": {
  "babel-polyfill": "^6.8.0",
  "babel-runtime": "^6.6.1",
  "vue": "^1.0.24",
  "vue-router": "^0.7.13",
  "vue-scrollbar": "^1.0.4",
  "vue-strap": "^1.0.7",
  "vuex": "^0.6.3"
}
BosNaufal commented 8 years ago

Hi @yoonge, Thank you for sending me an issue and sorry for slow response~

For your problem, it seems I forgot to removeEventListener from the document. so, when it is clicked then change to another route, while the mouse move it still triggers "dragging" event but there's no function to run. therefore, it happens. :grin:

To fix this problem, just remove its event before it component destroy~

It's just my quick observation. If you have any opinions, I'd like to hear it ~ :smile:

yoonge commented 8 years ago

@BosNaufal For now, I've no better idea. Follow your advice, I've fixed this problem, thanks. But unfortunately, a new problem is confusing me now, when I load data dynamically into the vue-scrollbar's child node, it doesn't work.

BTW: My English so-so, hope u can read & understand.

BosNaufal commented 8 years ago

Hmm.. I got it. Do you mean when the child of vue-scrollbar change, the vue-scrollbar height doesn't change and it becomes not working properly?

If it's your problem now, you can easily call this.calculateSize() before scroll event. Just like what I've done in React Scrollbar Please check The Highlighted line. And you can put it to this line.

It seems Vue Scrollbar is left behind than React Scrollbar. I'm so sorry about that, cause some of my projects is causing me work on React first :grin:

If you don't mind, you can give me a pull request. So, I can merge it~

yoonge commented 8 years ago

Do you mean when the child of vue-scrollbar change, the vue-scrollbar height doesn't change and it becomes not working properly?

Yes, that's my problem.

I've tried your sugguestion, but still failed. Considering that I still have a lot of work to do, I have to leave this problem aside for the moment.

Anyway, thanks for your reply. I will try to figure this out when I'm not so busy, maybe this weekend.

BosNaufal commented 7 years ago

https://github.com/BosNaufal/vue2-scrollbar