Skip to content

Commit 4b282ef

Browse files
committed
refactor: improve watcher and set default direction with config
1 parent 4ef21e4 commit 4b282ef

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/InfiniteLoading.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default {
8787
},
8888
direction: {
8989
type: String,
90-
default: 'bottom',
90+
default: config.props.direction,
9191
},
9292
forceUseInfiniteWrapper: {
9393
type: [Boolean, String],
@@ -99,15 +99,14 @@ export default {
9999
onInfinite: Function,
100100
},
101101
watch: {
102-
forceUseInfiniteWrapper() {
103-
this.scrollParent = this.getScrollParent();
104-
},
105102
identifier() {
106103
this.stateChanger.reset();
107104
},
108105
},
109106
mounted() {
110-
this.scrollParent = this.getScrollParent();
107+
this.$watch('forceUseInfiniteWrapper', () => {
108+
this.scrollParent = this.getScrollParent();
109+
}, { immediate: true });
111110
112111
this.scrollHandler = function scrollHandlerOriginal(ev) {
113112
if (!this.isLoading) {

0 commit comments

Comments
 (0)