7fa943eb
梁灏
init
|
1
2
3
|
<template>
<div v-if="showSizer || showElevator" :class="optsClasses">
<div v-if="showSizer" :class="sizerClasses">
|
a7a79014
梁灏
fixed #3112
|
4
|
<i-select v-model="currentPageSize" :size="size" :placement="placement" :transfer="transfer" @on-change="changeSize">
|
8ac8d1ed
梁灏
修复警告
|
5
|
<i-option v-for="item in pageSizeOpts" :key="item" :value="item" style="text-align:center;">{{ item }} {{ t('i.page.page') }}</i-option>
|
e355dd49
梁灏
add Select Component
|
6
|
</i-select>
|
7fa943eb
梁灏
init
|
7
8
|
</div>
<div v-if="showElevator" :class="ElevatorClasses">
|
012cbf28
梁灏
update locale
|
9
|
{{ t('i.page.goto') }}
|
c17c5ad6
Sergio Crisostomo
normalize autocom...
|
10
11
12
13
14
15
16
|
<input
type="text"
:value="_current"
autocomplete="off"
spellcheck="false"
@keyup.enter="changePage"
>
|
012cbf28
梁灏
update locale
|
17
|
{{ t('i.page.p') }}
|
7fa943eb
梁灏
init
|
18
19
20
21
|
</div>
</div>
</template>
<script>
|
e355dd49
梁灏
add Select Component
|
22
23
|
import iSelect from '../../components/select/select.vue';
import iOption from '../../components/select/option.vue';
|
012cbf28
梁灏
update locale
|
24
|
import Locale from '../../mixins/locale';
|
e355dd49
梁灏
add Select Component
|
25
|
|
7fa943eb
梁灏
init
|
26
27
28
29
30
31
32
|
const prefixCls = 'ivu-page';
function isValueNumber (value) {
return (/^[1-9][0-9]*$/).test(value + '');
}
export default {
|
87c51597
梁灏
support Page
|
33
|
name: 'PageOption',
|
012cbf28
梁灏
update locale
|
34
|
mixins: [ Locale ],
|
e355dd49
梁灏
add Select Component
|
35
|
components: { iSelect, iOption },
|
7fa943eb
梁灏
init
|
36
37
38
39
40
41
42
|
props: {
pageSizeOpts: Array,
showSizer: Boolean,
showElevator: Boolean,
current: Number,
_current: Number,
pageSize: Number,
|
6932b4d7
梁灏
update Page compo...
|
43
|
allPages: Number,
|
f89dd9c2
梁灏
Paeg、Select add p...
|
44
|
isSmall: Boolean,
|
a7a79014
梁灏
fixed #3112
|
45
46
|
placement: String,
transfer: Boolean
|
7fa943eb
梁灏
init
|
47
|
},
|
87c51597
梁灏
support Page
|
48
49
50
|
data () {
return {
currentPageSize: this.pageSize
|
191068ac
梁灏
fixed lint
|
51
|
};
|
87c51597
梁灏
support Page
|
52
53
54
55
56
57
|
},
watch: {
pageSize (val) {
this.currentPageSize = val;
}
},
|
7fa943eb
梁灏
init
|
58
|
computed: {
|
6932b4d7
梁灏
update Page compo...
|
59
60
61
|
size () {
return this.isSmall ? 'small' : 'default';
},
|
7fa943eb
梁灏
init
|
62
63
64
|
optsClasses () {
return [
`${prefixCls}-options`
|
b0893113
jingsam
add eslint
|
65
|
];
|
7fa943eb
梁灏
init
|
66
67
68
69
|
},
sizerClasses () {
return [
`${prefixCls}-options-sizer`
|
b0893113
jingsam
add eslint
|
70
|
];
|
7fa943eb
梁灏
init
|
71
72
73
74
|
},
ElevatorClasses () {
return [
`${prefixCls}-options-elevator`
|
b0893113
jingsam
add eslint
|
75
|
];
|
7fa943eb
梁灏
init
|
76
77
78
79
|
}
},
methods: {
changeSize () {
|
87c51597
梁灏
support Page
|
80
|
this.$emit('on-size', this.currentPageSize);
|
7fa943eb
梁灏
init
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
},
changePage (event) {
let val = event.target.value.trim();
let page = 0;
if (isValueNumber(val)) {
val = Number(val);
if (val != this.current) {
const allPages = this.allPages;
if (val > allPages) {
page = allPages;
} else {
page = val;
}
}
} else {
page = 1;
}
if (page) {
this.$emit('on-page', page);
event.target.value = page;
}
}
}
|
b0893113
jingsam
add eslint
|
107
|
};
|
c17c5ad6
Sergio Crisostomo
normalize autocom...
|
108
|
</script>
|