first
This commit is contained in:
1
node_modules/vant/es/pagination/index.css
generated
vendored
Normal file
1
node_modules/vant/es/pagination/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-pagination{display:-webkit-box;display:-webkit-flex;display:flex;font-size:14px}.van-pagination__item,.van-pagination__page-desc{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.van-pagination__item{-webkit-box-flex:1;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:36px;height:40px;color:#1989fa;background-color:#fff;cursor:pointer;-webkit-user-select:none;user-select:none}.van-pagination__item:active{color:#fff;background-color:#1989fa}.van-pagination__item::after{border-width:1px 0 1px 1px}.van-pagination__item:last-child::after{border-right-width:1px}.van-pagination__item--active{color:#fff;background-color:#1989fa}.van-pagination__next,.van-pagination__prev{padding:0 4px;cursor:pointer}.van-pagination__item--disabled,.van-pagination__item--disabled:active{color:#646566;background-color:#f7f8fa;cursor:not-allowed;opacity:.5}.van-pagination__page{-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.van-pagination__page-desc{-webkit-box-flex:1;-webkit-flex:1;flex:1;height:40px;color:#646566}.van-pagination--simple .van-pagination__next::after,.van-pagination--simple .van-pagination__prev::after{border-width:1px}
|
168
node_modules/vant/es/pagination/index.js
generated
vendored
Normal file
168
node_modules/vant/es/pagination/index.js
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
import { createNamespace } from '../utils';
|
||||
import { BORDER } from '../utils/constant';
|
||||
|
||||
var _createNamespace = createNamespace('pagination'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1],
|
||||
t = _createNamespace[2];
|
||||
|
||||
function makePage(number, text, active) {
|
||||
return {
|
||||
number: number,
|
||||
text: text,
|
||||
active: active
|
||||
};
|
||||
}
|
||||
|
||||
export default createComponent({
|
||||
props: {
|
||||
prevText: String,
|
||||
nextText: String,
|
||||
forceEllipses: Boolean,
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'multi'
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pageCount: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
totalItems: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
itemsPerPage: {
|
||||
type: [Number, String],
|
||||
default: 10
|
||||
},
|
||||
showPageSize: {
|
||||
type: [Number, String],
|
||||
default: 5
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count: function count() {
|
||||
var count = this.pageCount || Math.ceil(this.totalItems / this.itemsPerPage);
|
||||
return Math.max(1, count);
|
||||
},
|
||||
pages: function pages() {
|
||||
var pages = [];
|
||||
var pageCount = this.count;
|
||||
var showPageSize = +this.showPageSize;
|
||||
|
||||
if (this.mode !== 'multi') {
|
||||
return pages;
|
||||
} // Default page limits
|
||||
|
||||
|
||||
var startPage = 1;
|
||||
var endPage = pageCount;
|
||||
var isMaxSized = showPageSize < pageCount; // recompute if showPageSize
|
||||
|
||||
if (isMaxSized) {
|
||||
// Current page is displayed in the middle of the visible ones
|
||||
startPage = Math.max(this.value - Math.floor(showPageSize / 2), 1);
|
||||
endPage = startPage + showPageSize - 1; // Adjust if limit is exceeded
|
||||
|
||||
if (endPage > pageCount) {
|
||||
endPage = pageCount;
|
||||
startPage = endPage - showPageSize + 1;
|
||||
}
|
||||
} // Add page number links
|
||||
|
||||
|
||||
for (var number = startPage; number <= endPage; number++) {
|
||||
var page = makePage(number, number, number === this.value);
|
||||
pages.push(page);
|
||||
} // Add links to move between page sets
|
||||
|
||||
|
||||
if (isMaxSized && showPageSize > 0 && this.forceEllipses) {
|
||||
if (startPage > 1) {
|
||||
var previousPageSet = makePage(startPage - 1, '...', false);
|
||||
pages.unshift(previousPageSet);
|
||||
}
|
||||
|
||||
if (endPage < pageCount) {
|
||||
var nextPageSet = makePage(endPage + 1, '...', false);
|
||||
pages.push(nextPageSet);
|
||||
}
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler: function handler(page) {
|
||||
this.select(page || this.value);
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
select: function select(page, emitChange) {
|
||||
page = Math.min(this.count, Math.max(1, page));
|
||||
|
||||
if (this.value !== page) {
|
||||
this.$emit('input', page);
|
||||
|
||||
if (emitChange) {
|
||||
this.$emit('change', page);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
var _this = this,
|
||||
_this$slots,
|
||||
_this$slots3;
|
||||
|
||||
var h = arguments[0];
|
||||
var value = this.value;
|
||||
var simple = this.mode !== 'multi';
|
||||
|
||||
var onSelect = function onSelect(value) {
|
||||
return function () {
|
||||
_this.select(value, true);
|
||||
};
|
||||
};
|
||||
|
||||
return h("ul", {
|
||||
"class": bem({
|
||||
simple: simple
|
||||
})
|
||||
}, [h("li", {
|
||||
"class": [bem('item', {
|
||||
disabled: value === 1
|
||||
}), bem('prev'), BORDER],
|
||||
"on": {
|
||||
"click": onSelect(value - 1)
|
||||
}
|
||||
}, [((_this$slots = this.slots('prev-text')) != null ? _this$slots : this.prevText) || t('prev')]), this.pages.map(function (page) {
|
||||
var _this$slots2;
|
||||
|
||||
return h("li", {
|
||||
"class": [bem('item', {
|
||||
active: page.active
|
||||
}), bem('page'), BORDER],
|
||||
"on": {
|
||||
"click": onSelect(page.number)
|
||||
}
|
||||
}, [(_this$slots2 = _this.slots('page', page)) != null ? _this$slots2 : page.text]);
|
||||
}), simple && h("li", {
|
||||
"class": bem('page-desc')
|
||||
}, [this.slots('pageDesc') || value + "/" + this.count]), h("li", {
|
||||
"class": [bem('item', {
|
||||
disabled: value === this.count
|
||||
}), bem('next'), BORDER],
|
||||
"on": {
|
||||
"click": onSelect(value + 1)
|
||||
}
|
||||
}, [((_this$slots3 = this.slots('next-text')) != null ? _this$slots3 : this.nextText) || t('next')])]);
|
||||
}
|
||||
});
|
77
node_modules/vant/es/pagination/index.less
generated
vendored
Normal file
77
node_modules/vant/es/pagination/index.less
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-pagination {
|
||||
display: flex;
|
||||
font-size: @pagination-font-size;
|
||||
|
||||
&__item,
|
||||
&__page-desc {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&__item {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
min-width: @pagination-item-width;
|
||||
height: @pagination-height;
|
||||
color: @pagination-item-default-color;
|
||||
background-color: @pagination-background-color;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
|
||||
&:active {
|
||||
color: @white;
|
||||
background-color: @pagination-item-default-color;
|
||||
}
|
||||
|
||||
&::after {
|
||||
border-width: @border-width-base 0 @border-width-base @border-width-base;
|
||||
}
|
||||
|
||||
&:last-child::after {
|
||||
border-right-width: @border-width-base;
|
||||
}
|
||||
|
||||
&--active {
|
||||
color: @white;
|
||||
background-color: @pagination-item-default-color;
|
||||
}
|
||||
}
|
||||
|
||||
&__prev,
|
||||
&__next {
|
||||
padding: 0 @padding-base;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&__item--disabled {
|
||||
&,
|
||||
&:active {
|
||||
color: @pagination-item-disabled-color;
|
||||
background-color: @pagination-item-disabled-background-color;
|
||||
cursor: not-allowed;
|
||||
opacity: @pagination-disabled-opacity;
|
||||
}
|
||||
}
|
||||
|
||||
&__page {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
&__page-desc {
|
||||
flex: 1;
|
||||
height: @pagination-height;
|
||||
color: @pagination-desc-color;
|
||||
}
|
||||
|
||||
&--simple {
|
||||
.van-pagination__prev,
|
||||
.van-pagination__next {
|
||||
&::after {
|
||||
border-width: @border-width-base;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2
node_modules/vant/es/pagination/style/index.js
generated
vendored
Normal file
2
node_modules/vant/es/pagination/style/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import '../../style/base.css';
|
||||
import '../index.css';
|
2
node_modules/vant/es/pagination/style/less.js
generated
vendored
Normal file
2
node_modules/vant/es/pagination/style/less.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import '../../style/base.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user