some component support i18n

some component support i18n
This commit is contained in:
梁灏 2017-01-11 21:02:55 +08:00
parent d33b51432d
commit 4ab118119a
13 changed files with 238 additions and 30 deletions

View file

@ -1,19 +1,21 @@
<template>
<div :class="[prefixCls + '-confirm']">
<span :class="timeClasses" v-if="showTime" @click="handleToggleTime">
<template v-if="isTime">选择日期</template>
<template v-else>选择时间</template>
<template v-if="isTime">{{ t('i.datepicker.selectDate') }}</template>
<template v-else>{{ t('i.datepicker.selectTime') }}</template>
</span>
<i-button size="small" type="text" @click="handleClear">清空</i-button>
<i-button size="small" type="primary" @click="handleSuccess">确定</i-button>
<i-button size="small" type="text" @click="handleClear">{{ t('i.datepicker.clear') }}</i-button>
<i-button size="small" type="primary" @click="handleSuccess">{{ t('i.datepicker.ok') }}</i-button>
</div>
</template>
<script>
import iButton from '../../button/button.vue';
import Locale from '../../../mixins/locale';
const prefixCls = 'ivu-picker';
export default {
mixins: [ Locale ],
components: { iButton },
props: {
showTime: false,

View file

@ -4,7 +4,7 @@
@click="handleClick"
@mousemove="handleMouseMove">
<div :class="[prefixCls + '-header']">
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
<span>{{ t('i.datepicker.weeks.sun') }}</span><span>{{ t('i.datepicker.weeks.mon') }}</span><span>{{ t('i.datepicker.weeks.tue') }}</span><span>{{ t('i.datepicker.weeks.wed') }}</span><span>{{ t('i.datepicker.weeks.thu') }}</span><span>{{ t('i.datepicker.weeks.fri') }}</span><span>{{ t('i.datepicker.weeks.sat') }}</span>
</div>
<span :class="getCellCls(cell)" v-for="cell in readCells"><em :index="$index">{{ cell.text }}</em></span>
</div>
@ -12,6 +12,7 @@
<script>
import { getFirstDayOfMonth, getDayCountOfMonth } from '../util';
import { deepCopy } from '../../../utils/assist';
import Locale from '../../../mixins/locale';
const prefixCls = 'ivu-date-picker-cells';
@ -22,6 +23,7 @@
};
export default {
mixins: [ Locale ],
props: {
date: {},
year: {},

View file

@ -1,13 +1,15 @@
<template>
<div :class="classes" @click="handleClick">
<span :class="getCellCls(cell)" v-for="cell in cells"><em :index="$index">{{ cell.text }}</em></span>
<span :class="getCellCls(cell)" v-for="cell in cells"><em :index="$index">{{ tCell(cell.text) }}</em></span>
</div>
</template>
<script>
import { deepCopy } from '../../../utils/assist';
import Locale from '../../../mixins/locale';
const prefixCls = 'ivu-date-picker-cells';
export default {
mixins: [ Locale ],
props: {
date: {},
month: {
@ -68,6 +70,9 @@
this.$emit('on-pick', index);
}
this.$emit('on-pick-click');
},
tCell (cell) {
return this.t(`i.datepicker.months.m${cell}`);
}
}
};