Files
arcx-app/src/components/Avatar.vue
2025-11-25 16:53:19 +08:00

50 lines
812 B
Vue

<script setup>
const props = defineProps({
src: {
type: String,
default: "",
},
onClick: {
type: Function,
default: () => {},
},
size: {
type: Number,
default: 45,
},
borderColor: {
type: String,
default: "",
},
});
</script>
<template>
<view class="avatar" @click="onClick">
<image
:src="src || '../static/user-icon.png'"
mode="widthFix"
:style="{
width: size + 'px',
height: size + 'px',
minHeight: size + 'px',
borderColor: borderColor || '#fff',
}"
class="avatar-image"
/>
</view>
</template>
<style scoped>
.avatar {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-image {
border-radius: 50%;
border: 1px solid #fff;
}
</style>