32 lines
527 B
Vue
32 lines
527 B
Vue
<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>
|