chore: optimize the i18n code of router; 🌟

This commit is contained in:
chenghongxing
2020-07-20 21:39:00 +08:00
parent d91f3a8661
commit d21a2ab062
12 changed files with 144 additions and 110 deletions

View File

@@ -16,11 +16,15 @@ const timeList = [
CN: '中午好',
HK: '中午好',
US: 'Good afternoon',
},{
CN: '下午好',
HK: '下午好',
US: 'Good afternoon',
},{
CN: '晚上好',
HK: '晚上好',
US: 'Good evening',
},
}
]
const welcomeMessages = [
@@ -56,7 +60,8 @@ Random.extend({
timeFix () {
const time = new Date()
const hour = time.getHours()
return hour < 9 ? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
return hour < 9
? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
},
avatar () {
return this.pick(avatars)