Refactor(ALL):Vue3同步调整为Vue2
This commit is contained in:
@@ -31,34 +31,42 @@
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onMounted, ref} from '@vue/composition-api'
|
||||
import {VUE_APP_RESOURCES_URL as webUrl} from '../../config/index'
|
||||
<script>
|
||||
import {payoutLog} from "@/api/user";
|
||||
|
||||
const ready = ref(false)
|
||||
onMounted(() => {
|
||||
fetchData()
|
||||
ready.value = true
|
||||
})
|
||||
const list = ref([])
|
||||
const page = ref(1)
|
||||
const fetchData = async () => {
|
||||
const res = await payoutLog(page.value)
|
||||
if (res.success) {
|
||||
let count = 0
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
count++
|
||||
list.value.push(res.data[i])
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
ready: false,
|
||||
list: [],
|
||||
page: 1,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData()
|
||||
this.ready = true
|
||||
},
|
||||
methods: {
|
||||
async fetchData() {
|
||||
const res = await payoutLog(this.page)
|
||||
if (res.success) {
|
||||
let count = 0
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
count++
|
||||
this.list.push(res.data[i])
|
||||
}
|
||||
if (count < 10 && this.page === 1) this.scrollToLower()
|
||||
}
|
||||
},
|
||||
|
||||
scrollToLower() {
|
||||
this.page++
|
||||
this.fetchData()
|
||||
}
|
||||
if (count < 10 && page.value === 1) scrollToLower()
|
||||
}
|
||||
}
|
||||
|
||||
const scrollToLower = () => {
|
||||
page.value++
|
||||
fetchData()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user