|
@@ -37,7 +37,10 @@ import {
|
|
|
onUnmounted,
|
|
onUnmounted,
|
|
|
reactive,
|
|
reactive,
|
|
|
computed,
|
|
computed,
|
|
|
- CSSProperties
|
|
|
|
|
|
|
+ CSSProperties,
|
|
|
|
|
+ onActivated,
|
|
|
|
|
+ onDeactivated,
|
|
|
|
|
+ ref
|
|
|
} from 'vue';
|
|
} from 'vue';
|
|
|
import { createComponent } from '../../utils/create';
|
|
import { createComponent } from '../../utils/create';
|
|
|
const { componentName, create } = createComponent('infiniteloading');
|
|
const { componentName, create } = createComponent('infiniteloading');
|
|
@@ -268,6 +271,24 @@ export default create({
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const isKeepAlive = ref(false);
|
|
|
|
|
+
|
|
|
|
|
+ onActivated(() => {
|
|
|
|
|
+ if (isKeepAlive.value) {
|
|
|
|
|
+ isKeepAlive.value = false;
|
|
|
|
|
+ scrollListener();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ onDeactivated(() => {
|
|
|
|
|
+ isKeepAlive.value = true;
|
|
|
|
|
+ state.scrollEl.removeEventListener(
|
|
|
|
|
+ 'scroll',
|
|
|
|
|
+ handleScroll,
|
|
|
|
|
+ props.useCapture
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
classes,
|
|
classes,
|
|
|
...toRefs(state),
|
|
...toRefs(state),
|