fixed some components bug that can not translate when using vue-i18n

This commit is contained in:
梁灏 2017-03-30 16:05:20 +08:00
parent ed91d9b0c7
commit e5337c810c
8 changed files with 185 additions and 153 deletions

View file

@ -12,7 +12,7 @@
:data="rebuildData"></table-head>
</div>
<div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll"
v-show="!((!!noDataText && (!data || data.length === 0)) || (!!noFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
<table-body
ref="tbody"
:prefix-cls="prefixCls"
@ -24,13 +24,13 @@
</div>
<div
:class="[prefixCls + '-tip']"
v-show="((!!noDataText && (!data || data.length === 0)) || (!!noFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
v-show="((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td :style="{ 'height': bodyStyle.height }">
<span v-html="noDataText" v-if="!data || data.length === 0"></span>
<span v-html="noFilteredDataText" v-else></span>
<span v-html="localeNoDataText" v-if="!data || data.length === 0"></span>
<span v-html="localeNoFilteredDataText" v-else></span>
</td>
</tr>
</tbody>
@ -88,13 +88,15 @@
import tableHead from './table-head.vue';
import tableBody from './table-body.vue';
import { oneOf, getStyle, deepCopy, getScrollBarSize } from '../../utils/assist';
import { t } from '../../locale';
import Csv from '../../utils/csv';
import ExportCsv from './export-csv';
import Locale from '../../mixins/locale';
const prefixCls = 'ivu-table';
export default {
name: 'Table',
mixins: [ Locale ],
components: { tableHead, tableBody },
props: {
data: {
@ -146,16 +148,10 @@
type: Object
},
noDataText: {
type: String,
default () {
return t('i.table.noDataText');
}
type: String
},
noFilteredDataText: {
type: String,
default () {
return t('i.table.noFilteredDataText');
}
type: String
}
},
data () {
@ -178,6 +174,20 @@
};
},
computed: {
localeNoDataText () {
if (this.noDataText === undefined) {
return this.t('i.table.noDataText');
} else {
return this.noDataText;
}
},
localeNoFilteredDataText () {
if (this.noFilteredDataText === undefined) {
return this.t('i.table.noFilteredDataText');
} else {
return this.noFilteredDataText;
}
},
wrapClasses () {
return [
`${prefixCls}-wrapper`,