Skip to content

Commit

Permalink
Pagination: fix i18n, fixed ElemeFE#928 (ElemeFE#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li authored and furybean committed Nov 22, 2016
1 parent a8373aa commit 2d5bc59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"cross-env": "^3.1.3",
"css-loader": "^0.24.0",
"es6-promise": "^4.0.5",
"eslint": "^3.10.2",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"file-save": "^0.2.0",
Expand Down
16 changes: 11 additions & 5 deletions packages/pagination/src/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Pager from './pager.vue';
import ElSelect from 'element-ui/packages/select';
import ElOption from 'element-ui/packages/option';
import Migrating from 'element-ui/src/mixins/migrating';
import { t } from 'element-ui/src/locale';
import Locale from 'element-ui/src/mixins/locale';

export default {
name: 'ElPagination',
Expand Down Expand Up @@ -117,6 +117,8 @@ export default {
},

Sizes: {
mixins: [Locale],

created() {
if (Array.isArray(this.$parent.pageSizes)) {
this.$parent.internalPageSize = this.$parent.pageSizes.indexOf(this.$parent.pageSize) > -1
Expand All @@ -137,7 +139,7 @@ export default {
this.$parent.pageSizes.map(item =>
<el-option
value={ item }
label={ item + ' ' + t('el.pagination.pagesize') }>
label={ item + ' ' + this.t('el.pagination.pagesize') }>
</el-option>
)
}
Expand All @@ -162,6 +164,8 @@ export default {
},

Jumper: {
mixins: [Locale],

data() {
return {
oldValue: null
Expand All @@ -186,7 +190,7 @@ export default {
render(h) {
return (
<span class="el-pagination__jump">
{ t('el.pagination.goto') }
{ this.t('el.pagination.goto') }
<input
class="el-pagination__editor"
type="number"
Expand All @@ -197,17 +201,19 @@ export default {
on-focus={ this.handleFocus }
style={{ width: '30px' }}
number/>
{ t('el.pagination.pageClassifier') }
{ this.t('el.pagination.pageClassifier') }
</span>
);
}
},

Total: {
mixins: [Locale],

render(h) {
return (
typeof this.$parent.total === 'number'
? <span class="el-pagination__total">{ t('el.pagination.total', { total: this.$parent.total }) }</span>
? <span class="el-pagination__total">{ this.t('el.pagination.total', { total: this.$parent.total }) }</span>
: ''
);
}
Expand Down

0 comments on commit 2d5bc59

Please sign in to comment.