28 lines
765 B
Vue
28 lines
765 B
Vue
<script setup>
|
|
import { ref } from "vue";
|
|
import { onReachBottom } from "@dcloudio/uni-app"
|
|
const emit = defineEmits(["reachBottom"])
|
|
// 当前数量,总数量
|
|
const props = defineProps({
|
|
number: Number,
|
|
total: Number
|
|
})
|
|
let loadState = ref("loading")
|
|
// 触底事件
|
|
onReachBottom(() => {
|
|
console.log(props);
|
|
if (props.number < props.total) {
|
|
loadState.value = "loading"
|
|
} else if (props.number == props.total) {
|
|
loadState.value = "finished"
|
|
}
|
|
emit("reachBottom")
|
|
})
|
|
</script>
|
|
<template>
|
|
<slot></slot>
|
|
<wd-watermark content="wot-design-uni"></wd-watermark>
|
|
<wd-loadmore style="background-color: aqua;" custom-class="loadmore" :state="loadState" loading-text="数据加载中"/>
|
|
</template>
|
|
<style>
|
|
</style> |