mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-12 10:45:10 +08:00
fix(avatar): need reset hasLoadError to false, if src changed (#1515)
This commit is contained in:
parent
f2870e1984
commit
8cdfe1c831
@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref, PropType } from 'vue'
|
||||
import { defineComponent, computed, ref, PropType, watch, toRefs } from 'vue'
|
||||
|
||||
const ERROR_EVENT = 'error'
|
||||
export default defineComponent({
|
||||
@ -50,6 +50,12 @@ export default defineComponent({
|
||||
setup(props, { emit }) {
|
||||
const hasLoadError = ref(false)
|
||||
|
||||
const { src } = toRefs(props)
|
||||
// need reset hasLoadError to false if src changed
|
||||
watch(src,()=>{
|
||||
hasLoadError.value = false
|
||||
})
|
||||
|
||||
const avatarClass = computed(() => {
|
||||
const { size, icon, shape } = props
|
||||
let classList = ['el-avatar']
|
||||
|
Loading…
Reference in New Issue
Block a user