代码拉取完成,页面将自动刷新
设备 / 浏览器
微信开发者工具
Vant 版本
2.10.9
Vue 版本
2.6.1
重现链接
描述问题
使用van-list 时报错 之前都没问题,搁置了几个月后 最近打开发现出现了此错误
代码
<template>
<div class="view-voucher">
<van-list
v-model="loading"
:finished="finished"
offset="50"
finished-text="没有更多了"
@load="handleGetCouponList"
>
<template v-for="item in voucherList">
<voucherCard
:key="item.couponId"
:voucherData="item"
/>
</template>
</van-list>
</div>
</template>
<script>
import voucherCard from '@/pageComponents/voucherCard'
import { getCouponList } from '@/api'
export default {
name: 'Voucher',
components: {
voucherCard,
},
data () {
return {
finished: false,
loading: false,
formData: {
pageIndex: 1,
pageSize: 20,
},
disabledCoupons: false,
voucherList: [],
}
},
methods: {
handleGetCouponList () {
getCouponList(this.formData).then(res => {
if (res.length < 20) {
this.finished = true
}
this.loading = false
this.voucherList.push(...res)
this.formData.pageIndex++
})
},
},
}
</script>
<style lang="scss" scoped>
.view-voucher {
font-size: 16px;
padding: 10px 12px;
background-color: $themBgColor;
}
</style>