feat: 完成70%全局样式与可读性优化
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<image class="app-avatar" :src="avatarSource" mode="aspectFill" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from "vue";
|
||||
import { getDefaultAvatar } from "@/utils/avatar.js";
|
||||
|
||||
const props = defineProps({
|
||||
sex: {
|
||||
type: [String, Number],
|
||||
default: "",
|
||||
},
|
||||
src: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const avatarSource = computed(
|
||||
() => props.src.trim() || getDefaultAvatar(props.sex),
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-avatar {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user