vant
vant copied to clipboard
van-list 报错 Cannot read property 'bottom' of undefined"
设备 / 浏览器 微信开发者工具
Vant 版本 2.10.9
Vue 版本 2.6.1
重现链接 https://gitee.com/vant-contrib/vant/issues/I3E8WZ 描述问题
- 使用van-list 时报错 之前都没问题,搁置了几个月后 最近打开发现出现了此错误
- 我并未在此组件或子组件 定义或使用'bottom' 属性
https://gitee.com/vant-contrib/vant/issues/I3E8WZ
代码
<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>
麻烦提供一下 codesandbox 复现链接
https://codesandbox.io/s/m5v3f