63 lines
1.2 KiB
Vue
63 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
interface Props {
|
|
summary: string
|
|
}
|
|
|
|
defineProps<Props>()
|
|
|
|
const greeting = computed(() => {
|
|
const hour = new Date().getHours()
|
|
if (hour < 6) return '夜深了'
|
|
if (hour < 11) return '早上好'
|
|
if (hour < 14) return '中午好'
|
|
if (hour < 18) return '下午好'
|
|
return '晚上好'
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="home-welcome">
|
|
<h2 class="home-welcome__greeting">
|
|
{{ greeting }}
|
|
<span class="home-welcome__wave">👋</span>
|
|
</h2>
|
|
<p class="home-welcome__summary">
|
|
{{ summary }}
|
|
</p>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
.home-welcome {
|
|
.flex(column, center, flex-start);
|
|
gap: @spacing-sm;
|
|
|
|
&__greeting {
|
|
.flex(row, flex-start);
|
|
gap: @spacing-sm;
|
|
// 设计稿「中午好」52px / 700 / #2C2C2C
|
|
font-size: 52px;
|
|
font-weight: 700;
|
|
color: @home-welcome;
|
|
}
|
|
|
|
&__wave {
|
|
.flex(row, center);
|
|
width: 44px;
|
|
height: 44px;
|
|
border-radius: @radius-round;
|
|
background: fade(@black, 4%);
|
|
font-size: @font-size-xl;
|
|
}
|
|
|
|
&__summary {
|
|
// 设计稿副文案 24px / 400 / #2C2C2C
|
|
font-size: 24px;
|
|
font-weight: 400;
|
|
color: @home-welcome;
|
|
}
|
|
}
|
|
</style>
|