mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-08 11:26:56 +08:00
46 lines
895 B
Vue
46 lines
895 B
Vue
<script setup>
|
|
import { ref, watch } from 'vue'
|
|
import * as models from '../../../data/chat/models'
|
|
|
|
const props = defineProps({
|
|
imgUrl: String,
|
|
height: String,
|
|
width: String,
|
|
})
|
|
|
|
const showImgUrl = ref(props.imgUrl)
|
|
|
|
watch(() => props.imgUrl, (val) => {
|
|
showImgUrl.value = val
|
|
})
|
|
|
|
function onLoadError() {
|
|
if (showImgUrl.value !== models.DEFAULT_AVATAR_URL) {
|
|
showImgUrl.value = models.DEFAULT_AVATAR_URL
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<yt-img-shadow
|
|
class="no-transition"
|
|
:height="height"
|
|
:width="width"
|
|
style="background-color: transparent;"
|
|
loaded
|
|
>
|
|
<img
|
|
id="img"
|
|
class="style-scope yt-img-shadow"
|
|
alt=""
|
|
:height="height"
|
|
:width="width"
|
|
:src="showImgUrl"
|
|
referrerpolicy="no-referrer"
|
|
@error="onLoadError"
|
|
>
|
|
</yt-img-shadow>
|
|
</template>
|
|
|
|
<style src="@/assets/css/youtube/yt-img-shadow.css"></style>
|