vue-infinite-loading icon indicating copy to clipboard operation
vue-infinite-loading copied to clipboard

infiniteLoading not work under transition without scrolling

Open shixy96 opened this issue 5 years ago • 9 comments

Version

2.4.3

Vue.js version

2.2.1

Reproduction Link

https://jsfiddle.net/shixy007/eywraw8t/479224/

Steps to reproduce

  1. click '/home' link
  2. click '/fool' link
  3. click '/home' link
  4. click '/fool' link

What is Expected?

每次点击 '/fool' 后都应该触发 infinite 进行加载

What is actually happening?

第二次点击 '/fool' 后都没有触发 infinite 进行加载;

Compared 1

  1. click '/home' link
  2. scroll down
  3. click '/fool' link
  4. click '/home' link
  5. scroll down
  6. click '/fool' link 加载正常

img

Compared 2

在去掉包裹 router-view 的 transition 之后,加载正常 https://jsfiddle.net/shixy007/eywraw8t/479226/

shixy96 avatar Nov 28 '18 05:11 shixy96

@shixy96 抱歉之前看到这个 issue 的时候以为是指列表元素的过渡动画,传达了错误的信息,为避免给其他人造成困扰所以上一条评论我先删除了。

重新看了一下你提供的 reproduce link,按照官方的文档通过 keep-alive 组件的 include/exclude 来控制组件是否缓存即可正常工作。

PeachScript avatar Nov 30 '18 01:11 PeachScript

hi,@PeachScript ,我不认为是 keep-alive 缓存的问题,我觉得还是过渡动画的问题,这里有一个新的链接,复现的步骤和前面一样 https://jsfiddle.net/shixy007/eywraw8t/482560/

shixy96 avatar Nov 30 '18 03:11 shixy96

这个示例是基于你一开始的 fiddle 修改的,正确使用条件式 keep-alive 可以正常工作:https://jsfiddle.net/oq7m0brn/ 这个示例是基于你刚刚提供的 fiddle 修改的,可以看到即便移除了 transition,还是不能正常工作:https://jsfiddle.net/k41s2d30/

所以我推测有可能是 vue-router 在多个命名视图渲染的切换过程中有什么特性影响到该插件的加载判断了,后续我会再验证一下该推测;如果你有其他发现也请更新到这里。

PeachScript avatar Nov 30 '18 06:11 PeachScript

我也出现同样的情况 在添加过渡的情况下 会出现无法触发的情况,但是如果直接进去的是这个带有无限加载的页面则可以正常触发,从其他tab点进去则不行

Yee2 avatar Dec 13 '18 15:12 Yee2

I also have the same problem.Going directly to the page that contains the vue-infinite-loading component, everything works fine. Going to another page and then to the page with the vue-infinite-loading doesn't load the items (doesn't even make the request) if the previous page was not scrolled down.

As soon as a remove the transition everything works fine.

<!-- <transition name="fade"> -->
      <router-view></router-view>
<!-- </transition> -->

Any solutions to this ?

middle21 avatar Jan 31 '20 10:01 middle21

I can reproduce the same thing that happens to @middleftw. Deleting the transition around the router view fixes the issue, but it shouldn't be like that.

Welcius avatar Feb 13 '20 14:02 Welcius

This also happens if component is used inside v-show (display: none)

dbettini avatar Apr 01 '20 19:04 dbettini

Any solution here? i have same with Uncaught (in promise) TypeError: can't access property "loaded", $state is undefined error

matinwd avatar Nov 29 '20 21:11 matinwd

Also using vue transitions

matinwd avatar Nov 29 '20 21:11 matinwd