ref="scroll"
:scrollEvents="['scroll']"
@scroll="onScroll"
:data="saleHouseModelAppList"
:options="scrollOptions"
@pulling-up="onPullingUp"
>
</cube-scroll>
data () {
return{
saleHouseModelAppList:[],
pullUpLoad: true,
pullUpLoadThreshold: 0,
pullUpLoadMoreTxt: '加载更多',
pullUpLoadNoMoreTxt: '更多项目正在录入中...',
}
},
computed: {
scrollOptions () {
return {
pullUpLoad: this.pullUpLoadObj,
scrollbar: false
}
},
pullUpLoadObj () {
return this.pullUpLoad ? {
threshold: parseInt(this.pullUpLoadThreshold),
txt: {
more: this.pullUpLoadMoreTxt,
noMore: this.pullUpLoadNoMoreTxt
}
} : false
}
},
methods:{
onScroll (pos) {
if(pos.y < -150) {
this.showWhiteTitle = true;
} else {
this.showWhiteTitle = false
}
},
getSaleHouseModelList () {
const _this = this;
let params = {
houseId:_this.$route.query.id,
pageRows:4,
currentPage:_this.currentPage
}
return this.$http.post('agency/house/getSaleHouseModelList',params).then((res) => {
if (res.data.code === 200 && res.data.data.list) {
let modeArr = res.data.data.list ;
if (res.data.data.pageNum === res.data.data.currentPage) {
_this.pullUpLoad = false;
} else {
_this.pullUpLoad = true;
}
for (let i = 0; i < modeArr.length; i++) {
modeArr[i].houseImg = modeArr[i].houseImg ? modeArr[i].houseImg.split(',') : '';
}
_this.saleHouseModelAppList = _this.saleHouseModelAppList.concat(modeArr);
_this.currentPage++
} else {
_this.hasData = false;
this.exceptionType = 'servererror';
}
})
},
onPullingUp () {
this.getSaleHouseModelList();
// 更新数据
setTimeout(() => {
this.$refs.scroll.forceUpdate()
}, 1000)
}
}