分页组件在本地环境是有效果的
但是打包到线上之后
下面是我的部分代码:
data() {
return {
tops: {},
news: {},
hots: {},
recommends: {},
PageSize:null,
totalPage:null,
currentPage:null,
}
},
mounted: function() {
var that = this;
this.$axios.get("/api/home/client?method=index").then(function(response) {
response = response.data;
that.tops = response.response.tops;
that.news = response.response.news.data;
that.hots = response.response.hots;
that.recommends = response.response.recs;
//分页数据
that.currentPage = parseInt(response.response.news.currentPage);
that.totalPage = parseInt(response.response.news.total);
that.PageSize = parseInt(response.response.news.per_page);
});
}
<!-- 分页组件 -->
<vue-paginate :PageSize='PageSize' :totalPage="totalPage" :currentPage="currentPage"></vue-paginate>
分页组件的代码:
props: {
totalPage: {
type: Number
},
PageSize: {
type: Number
},
currentPage: {
type: Number
}
},
methods: {
handleCurrentChange: function (val) {
this.$router.push({path:this.$route.path,query:{page: val}});
},
},
<el-pagination
background
layout="prev, pager, next"
:total="totalPage"
:page-size="PageSize"
:currentPage="currentPage"
@current-change="handleCurrentChange"
>
</el-pagination>
请问大佬们 线上环境这个分页为啥没效果了
是不是线上的数据没有拿到?