vue.js 的分页标签怎么修改
1个回答
展开全部
omponent('pagination',{
template:'#paginationTpl',
replace:true,
props:['cur','all','pageNum'],
methods:{
//页码点击事件
btnClick: function(index){
if(index != this.cur){
this.cur = index;
}
}
},
watch:{
"cur" : function(val,oldVal) {
this.$dispatch('page-to', val);
}
},
computed:{
indexes : function(){
var list = [];
//计算左右页码
var mid = parseInt(this.pageNum / 2);//中间值
var left = Math.max(this.cur - mid,1);
var right = Math.max(this.cur + this.pageNum - mid -1,this.pageNum);
if (right > this.all ) { right = this.all}
while (left <= right){
list.push(left);
template:'#paginationTpl',
replace:true,
props:['cur','all','pageNum'],
methods:{
//页码点击事件
btnClick: function(index){
if(index != this.cur){
this.cur = index;
}
}
},
watch:{
"cur" : function(val,oldVal) {
this.$dispatch('page-to', val);
}
},
computed:{
indexes : function(){
var list = [];
//计算左右页码
var mid = parseInt(this.pageNum / 2);//中间值
var left = Math.max(this.cur - mid,1);
var right = Math.max(this.cur + this.pageNum - mid -1,this.pageNum);
if (right > this.all ) { right = this.all}
while (left <= right){
list.push(left);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询