components: { },
data() {
return {
tabActive: 0,
badgeNum: 0,
toFeedBackBadgeNum: 0,
toFeedBackInterviewers: [], //列表数据源数组
isLoading: false,
limit1: 10, //每页多少条数据
offset1: 0, //第0页
finished1: false, // 数据是否请求结束,结束会先显示- 没有更多了 -
loading1: false, //默认刷新菊花不显示
};
},
mounted() {
this.$nextTick(_ =>{
this.tabActive = localStorage.getItem(‘activekey’) || 0;
})
this.getFeedBackInterviewers();
},
created() {},
methods: {
//接口获取数据源
getFeedBackInterviewers() {
this.loading1 = true; //调用接口请求开始的时候显示三方菊花loading
let offset1 = this.offset1 * this.limit1;
this.$service.java_recruit
.getInterviewList({
params: {
type: “2”,
limit: this.limit1,
offset: offset1,
},
})
.then(® => {
if (r.status == 200) {
this.loading1 = false; //不在调用下拉刷新
this.isLoading = false; //请求成功之后隐藏loading
if (r.data.rows.length < 10) {
this.finished1 = true; //设置为true
} else {
this.offset1++;
}
this.toFeedBackBadgeNum = r.data.total == 0 ? “” : r.data.total;
r.data.rows.forEach((e) => {
this.toFeedBackInterviewers.push(e);
});
}
});
},
//加载数据
onLoad1() {
this.getFeedBackInterviewers(); //调用数据源接口获取数据
},
//刷新数据
onRefresh1() {
setTimeout(() => {
// 重新初始化属性
this.isLoading = false; //隐藏loading
this.offset1 = 0;
this.loading1 = true;
this.finished1 = false;
this.toFeedBackInterviewers = [];
this.getFeedBackInterviewers(); //调用数据源接口获取数据
}, 500);
},
},
};