Refactor(ALL):Vue3同步调整为Vue2

This commit is contained in:
lifizer
2024-02-29 10:46:13 +08:00
parent f3115fe7c8
commit 017bb4a66a
13 changed files with 1805 additions and 1930 deletions
+30 -22
View File
@@ -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">