mescroll-uni官網地址:http://www.mescroll.com/uni.html?v=20200315
只實現下拉刷新,不實現上拉加載,在data中設置upOption如下:
upOption: {
use: false
}
參考代碼如下:
<template>
<mescroll-body ref="mescrollRef"
@init="mescrollInit"
@down="downCallback"
@up="upCallback" :up="upOption">
<view class="detail-row border-bt">
<view>{{objParking.content}}</view>
</view>
</mescroll-body>
</template>
<script>
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
mixins: [MescrollMixin], // 使用mixin (在main.js註冊全局組件)
data() {
return {
comid: "",
objParking: {},
upOption: {
use: false
}
}
},
onLoad: function(option) {
this.comid = option.comid;
},
methods: {
/*** 下拉刷新回調*/
downCallback() {
this.getDetail();
},
getDetail() {
if (!this.comid) {
return;
}
let params = {
comid: this.comid
}
this.$request.setRequest('/getParkInfo', params)
.then(res => {
if (res.data.status == 1) { //<=0:人工返回的錯誤信息
this.objParking = res.data.data[0];
this.mescroll.endSuccess();
} else if (res.data.status < 1) { //<=0:人工返回的錯誤信息
this.$request.setErrorMessage(res.data.msg);
this.mescroll.endErr()
} else {
this.$request.setErrorMessage();
this.mescroll.endErr()
}
}, (err) => {
this.mescroll.endErr()
})
},
}
}
</script>