save
This commit is contained in:
parent
8f9d3604e6
commit
5bb83ff8e5
258 changed files with 12974 additions and 7838 deletions
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div v-if="showSizer || showElevator" :class="optsClasses">
|
||||
<div v-if="showSizer" :class="sizerClasses">
|
||||
<i-select v-model="currentPageSize" :size="size" :placement="placement" :transfer="transfer" @on-change="changeSize">
|
||||
<i-select v-model="currentPageSize" :size="size" :placement="placement" :transfer="transfer" :disabled="disabled" @on-change="changeSize">
|
||||
<i-option v-for="item in pageSizeOpts" :key="item" :value="item" style="text-align:center;">{{ item }} {{ t('i.page.page') }}</i-option>
|
||||
</i-select>
|
||||
</div>
|
||||
|
@ -12,6 +12,7 @@
|
|||
:value="_current"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
:disabled="disabled"
|
||||
@keyup.enter="changePage"
|
||||
>
|
||||
{{ t('i.page.p') }}
|
||||
|
@ -43,7 +44,8 @@
|
|||
allPages: Number,
|
||||
isSmall: Boolean,
|
||||
placement: String,
|
||||
transfer: Boolean
|
||||
transfer: Boolean,
|
||||
disabled: Boolean
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<li
|
||||
:title="t('i.page.prev')"
|
||||
:class="prevClasses"
|
||||
@click.stop="prev">
|
||||
@click="prev">
|
||||
<a><i class="ivu-icon ivu-icon-ios-arrow-back"></i></a>
|
||||
</li>
|
||||
<div :class="simplePagerClasses" :title="currentPage + '/' + allPages">
|
||||
|
@ -12,6 +12,7 @@
|
|||
:value="currentPage"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
:disabled="disabled"
|
||||
@keydown="keyDown"
|
||||
@keyup="keyUp"
|
||||
@change="keyUp">
|
||||
|
@ -21,7 +22,7 @@
|
|||
<li
|
||||
:title="t('i.page.next')"
|
||||
:class="nextClasses"
|
||||
@click.stop="next">
|
||||
@click="next">
|
||||
<a><i class="ivu-icon ivu-icon-ios-arrow-forward"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -32,24 +33,24 @@
|
|||
<li
|
||||
:title="t('i.page.prev')"
|
||||
:class="prevClasses"
|
||||
@click.stop="prev">
|
||||
@click="prev">
|
||||
<a><template v-if="prevText !== ''">{{ prevText }}</template><i v-else class="ivu-icon ivu-icon-ios-arrow-back"></i></a>
|
||||
</li>
|
||||
<li title="1" :class="firstPageClasses" @click.stop="changePage(1)"><a>1</a></li>
|
||||
<li :title="t('i.page.prev5')" v-if="currentPage > 5" :class="[prefixCls + '-item-jump-prev']" @click.stop="fastPrev"><a><i class="ivu-icon ivu-icon-ios-arrow-back"></i></a></li>
|
||||
<li :title="currentPage - 3" v-if="currentPage === 5" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage - 3)"><a>{{ currentPage - 3 }}</a></li>
|
||||
<li :title="currentPage - 2" v-if="currentPage - 2 > 1" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage - 2)"><a>{{ currentPage - 2 }}</a></li>
|
||||
<li :title="currentPage - 1" v-if="currentPage - 1 > 1" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage - 1)"><a>{{ currentPage - 1 }}</a></li>
|
||||
<li title="1" :class="firstPageClasses" @click="changePage(1)"><a>1</a></li>
|
||||
<li :title="t('i.page.prev5')" v-if="currentPage > 5" :class="[prefixCls + '-item-jump-prev']" @click="fastPrev"><a><i class="ivu-icon ivu-icon-ios-arrow-back"></i></a></li>
|
||||
<li :title="currentPage - 3" v-if="currentPage === 5" :class="[prefixCls + '-item']" @click="changePage(currentPage - 3)"><a>{{ currentPage - 3 }}</a></li>
|
||||
<li :title="currentPage - 2" v-if="currentPage - 2 > 1" :class="[prefixCls + '-item']" @click="changePage(currentPage - 2)"><a>{{ currentPage - 2 }}</a></li>
|
||||
<li :title="currentPage - 1" v-if="currentPage - 1 > 1" :class="[prefixCls + '-item']" @click="changePage(currentPage - 1)"><a>{{ currentPage - 1 }}</a></li>
|
||||
<li :title="currentPage" v-if="currentPage != 1 && currentPage != allPages" :class="[prefixCls + '-item',prefixCls + '-item-active']"><a>{{ currentPage }}</a></li>
|
||||
<li :title="currentPage + 1" v-if="currentPage + 1 < allPages" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage + 1)"><a>{{ currentPage + 1 }}</a></li>
|
||||
<li :title="currentPage + 2" v-if="currentPage + 2 < allPages" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage + 2)"><a>{{ currentPage + 2 }}</a></li>
|
||||
<li :title="currentPage + 3" v-if="allPages - currentPage === 4" :class="[prefixCls + '-item']" @click.stop="changePage(currentPage + 3)"><a>{{ currentPage + 3 }}</a></li>
|
||||
<li :title="t('i.page.next5')" v-if="allPages - currentPage >= 5" :class="[prefixCls + '-item-jump-next']" @click.stop="fastNext"><a><i class="ivu-icon ivu-icon-ios-arrow-forward"></i></a></li>
|
||||
<li :title="allPages" v-if="allPages > 1" :class="lastPageClasses" @click.stop="changePage(allPages)"><a>{{ allPages }}</a></li>
|
||||
<li :title="currentPage + 1" v-if="currentPage + 1 < allPages" :class="[prefixCls + '-item']" @click="changePage(currentPage + 1)"><a>{{ currentPage + 1 }}</a></li>
|
||||
<li :title="currentPage + 2" v-if="currentPage + 2 < allPages" :class="[prefixCls + '-item']" @click="changePage(currentPage + 2)"><a>{{ currentPage + 2 }}</a></li>
|
||||
<li :title="currentPage + 3" v-if="allPages - currentPage === 4" :class="[prefixCls + '-item']" @click="changePage(currentPage + 3)"><a>{{ currentPage + 3 }}</a></li>
|
||||
<li :title="t('i.page.next5')" v-if="allPages - currentPage >= 5" :class="[prefixCls + '-item-jump-next']" @click="fastNext"><a><i class="ivu-icon ivu-icon-ios-arrow-forward"></i></a></li>
|
||||
<li :title="allPages" v-if="allPages > 1" :class="lastPageClasses" @click="changePage(allPages)"><a>{{ allPages }}</a></li>
|
||||
<li
|
||||
:title="t('i.page.next')"
|
||||
:class="nextClasses"
|
||||
@click.stop="next">
|
||||
@click="next">
|
||||
<a><template v-if="nextText !== ''">{{ nextText }}</template><i v-else class="ivu-icon ivu-icon-ios-arrow-forward"></i></a>
|
||||
</li>
|
||||
<Options
|
||||
|
@ -61,6 +62,7 @@
|
|||
:show-elevator="showElevator"
|
||||
:_current.once="currentPage"
|
||||
:current="currentPage"
|
||||
:disabled="disabled"
|
||||
:all-pages="allPages"
|
||||
:is-small="isSmall"
|
||||
@on-size="onSize"
|
||||
|
@ -145,11 +147,7 @@
|
|||
type: String,
|
||||
default: ''
|
||||
},
|
||||
cacheKey: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
cachePageSize: {
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
|
@ -200,6 +198,7 @@
|
|||
`${prefixCls}`,
|
||||
{
|
||||
[`${this.className}`]: !!this.className,
|
||||
[`${prefixCls}-with-disabled`]: this.disabled,
|
||||
'mini': !!this.size
|
||||
}
|
||||
];
|
||||
|
@ -208,7 +207,7 @@
|
|||
return [
|
||||
`${prefixCls}-prev`,
|
||||
{
|
||||
[`${prefixCls}-disabled`]: this.currentPage === 1,
|
||||
[`${prefixCls}-disabled`]: this.currentPage === 1 || this.disabled,
|
||||
[`${prefixCls}-custom-text`]: this.prevText !== ''
|
||||
}
|
||||
];
|
||||
|
@ -217,7 +216,7 @@
|
|||
return [
|
||||
`${prefixCls}-next`,
|
||||
{
|
||||
[`${prefixCls}-disabled`]: this.currentPage === this.allPages,
|
||||
[`${prefixCls}-disabled`]: this.currentPage === this.allPages || this.disabled,
|
||||
[`${prefixCls}-custom-text`]: this.nextText !== ''
|
||||
}
|
||||
];
|
||||
|
@ -237,17 +236,11 @@
|
|||
[`${prefixCls}-item-active`]: this.currentPage === this.allPages
|
||||
}
|
||||
];
|
||||
},
|
||||
pageSizeKey() {
|
||||
if (this.cachePageSize && this.cacheKey !== null) {
|
||||
return `pageSize_${this.cacheKey}`;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changePage (page) {
|
||||
if (this.disabled) return;
|
||||
if (this.currentPage != page) {
|
||||
this.currentPage = page;
|
||||
this.$emit('update:current', page);
|
||||
|
@ -255,6 +248,7 @@
|
|||
}
|
||||
},
|
||||
prev () {
|
||||
if (this.disabled) return;
|
||||
const current = this.currentPage;
|
||||
if (current <= 1) {
|
||||
return false;
|
||||
|
@ -262,6 +256,7 @@
|
|||
this.changePage(current - 1);
|
||||
},
|
||||
next () {
|
||||
if (this.disabled) return;
|
||||
const current = this.currentPage;
|
||||
if (current >= this.allPages) {
|
||||
return false;
|
||||
|
@ -269,6 +264,7 @@
|
|||
this.changePage(current + 1);
|
||||
},
|
||||
fastPrev () {
|
||||
if (this.disabled) return;
|
||||
const page = this.currentPage - 5;
|
||||
if (page > 0) {
|
||||
this.changePage(page);
|
||||
|
@ -277,6 +273,7 @@
|
|||
}
|
||||
},
|
||||
fastNext () {
|
||||
if (this.disabled) return;
|
||||
const page = this.currentPage + 5;
|
||||
if (page > this.allPages) {
|
||||
this.changePage(this.allPages);
|
||||
|
@ -285,14 +282,13 @@
|
|||
}
|
||||
},
|
||||
onSize (pageSize) {
|
||||
if (this.disabled) return;
|
||||
this.currentPageSize = pageSize;
|
||||
this.$emit('on-page-size-change', pageSize);
|
||||
this.changePage(1);
|
||||
if (this.cachePageSize && this.cacheKey !== null) {
|
||||
window.localStorage.setItem(this.pageSizeKey, pageSize);
|
||||
}
|
||||
},
|
||||
onPage (page) {
|
||||
if (this.disabled) return;
|
||||
this.changePage(page);
|
||||
},
|
||||
keyDown (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue