Revert "feat: add BaseUserAvatar and unify avatar usage"

This reverts commit efbb83924b.
This commit is contained in:
tim
2025-09-24 00:30:23 +08:00
parent 0f75a95dbe
commit a1eccb3b1e
15 changed files with 91 additions and 263 deletions
@@ -24,13 +24,10 @@
</template>
<template #option="{ option }">
<div class="search-option-item">
<BaseUserAvatar
<BaseImage
:src="option.avatar || '/default-avatar.svg'"
class="avatar"
:user-id="option.id"
:avatar="option.avatar"
:username="option.username"
:width="32"
:link="false"
@error="handleAvatarError"
/>
<div class="result-body">
<div class="result-main" v-html="highlight(option.username)"></div>
@@ -90,6 +87,10 @@ const highlight = (text) => {
return text.replace(reg, (m) => `<span class="highlight">${m}</span>`)
}
const handleAvatarError = (e) => {
e.target.src = '/default-avatar.svg'
}
watch(selected, async (val) => {
if (!val) return
const user = results.value.find((u) => u.id === val)
@@ -177,6 +178,8 @@ defineExpose({
.avatar {
width: 32px;
height: 32px;
border-radius: 50%;
object-fit: cover;
}
.result-body {