refactor: refactor code and add comment

This commit is contained in:
zyronon 2024-04-26 03:11:10 +08:00
parent bdb5651a65
commit a7665f4a23

View File

@ -271,8 +271,9 @@ function touchEnd(e) {
slideTouchEnd(e, state, canNext, (isNext) => {
let half = (props.virtualTotal - 1) / 2
if (props.list.length > props.virtualTotal) {
//
//()
if (isNext) {
// `dom` `dom`
if (state.localIndex > props.list.length - props.virtualTotal && state.localIndex > half) {
emit('loadMore')
}
@ -297,6 +298,7 @@ function touchEnd(e) {
})
}
} else {
// `dom` `dom`
if (state.localIndex >= half && state.localIndex < props.list.length - (half + 1)) {
let addIndex = state.localIndex - half
if (addIndex >= 0) {