js 里的属性使用 computed 国际化, 不能放在 data 里
This commit is contained in:
parent
81922206ca
commit
df14618621
|
@ -16,46 +16,45 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
endDate: new Date(),
|
endDate: new Date(),
|
||||||
unit: 'tests',
|
|
||||||
colorRange: ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127'],
|
colorRange: ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127'],
|
||||||
locale: {
|
}
|
||||||
// 一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月
|
},
|
||||||
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
computed: {
|
||||||
// 星期日 Sun. 星期一 Mon. 星期二 Tues. 星期三 Wed. 星期四 Thur. 星期五 Fri. 星期六 Sat.
|
locale() {
|
||||||
days: ['Sun', 'Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat'],
|
return {
|
||||||
|
months: [
|
||||||
|
this.$t('commons.months_1'),
|
||||||
|
this.$t('commons.months_2'),
|
||||||
|
this.$t('commons.months_3'),
|
||||||
|
this.$t('commons.months_4'),
|
||||||
|
this.$t('commons.months_5'),
|
||||||
|
this.$t('commons.months_6'),
|
||||||
|
this.$t('commons.months_7'),
|
||||||
|
this.$t('commons.months_8'),
|
||||||
|
this.$t('commons.months_9'),
|
||||||
|
this.$t('commons.months_10'),
|
||||||
|
this.$t('commons.months_11'),
|
||||||
|
this.$t('commons.months_12')
|
||||||
|
],
|
||||||
|
days: [
|
||||||
|
this.$t('commons.weeks_0'),
|
||||||
|
this.$t('commons.weeks_1'),
|
||||||
|
this.$t('commons.weeks_2'),
|
||||||
|
this.$t('commons.weeks_3'),
|
||||||
|
this.$t('commons.weeks_4'),
|
||||||
|
this.$t('commons.weeks_5'),
|
||||||
|
this.$t('commons.weeks_6')
|
||||||
|
],
|
||||||
No: 'No',
|
No: 'No',
|
||||||
on: ',',
|
on: ',',
|
||||||
less: 'Less',
|
less: 'Less',
|
||||||
more: 'More'
|
more: 'More'
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
unit() {
|
||||||
|
return this.$t('commons.test_unit')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.locale.months = [
|
|
||||||
this.$t('commons.months_1'),
|
|
||||||
this.$t('commons.months_2'),
|
|
||||||
this.$t('commons.months_3'),
|
|
||||||
this.$t('commons.months_4'),
|
|
||||||
this.$t('commons.months_5'),
|
|
||||||
this.$t('commons.months_6'),
|
|
||||||
this.$t('commons.months_7'),
|
|
||||||
this.$t('commons.months_8'),
|
|
||||||
this.$t('commons.months_9'),
|
|
||||||
this.$t('commons.months_10'),
|
|
||||||
this.$t('commons.months_11'),
|
|
||||||
this.$t('commons.months_12')
|
|
||||||
];
|
|
||||||
this.locale.days = [
|
|
||||||
this.$t('commons.weeks_0'),
|
|
||||||
this.$t('commons.weeks_1'),
|
|
||||||
this.$t('commons.weeks_2'),
|
|
||||||
this.$t('commons.weeks_3'),
|
|
||||||
this.$t('commons.weeks_4'),
|
|
||||||
this.$t('commons.weeks_5'),
|
|
||||||
this.$t('commons.weeks_6')
|
|
||||||
];
|
|
||||||
this.unit = this.$t('commons.test_unit')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue