util.js 429 B

1234567891011
  1. export function timeFix() {
  2. const time = new Date()
  3. const hour = time.getHours()
  4. return hour < 9 ? '早上好' : (hour <= 11 ? '上午好' : (hour <= 13 ? '中午好' : (hour < 20 ? '下午好' : '晚上好')))
  5. }
  6. export function welcome() {
  7. const arr = ['休息一会儿吧', '准备吃什么呢?', '我猜你可能累了']
  8. let index = Math.floor((Math.random() * arr.length))
  9. return arr[index]
  10. }