(component): 优化 avatar 组件代码结构

This commit is contained in:
就眠儀式 2022-10-09 16:09:30 +08:00
parent fba376bba7
commit 3beac422be
2 changed files with 4 additions and 7 deletions

View File

@ -38,10 +38,8 @@ const classes = computed(() => {
<span :class="classes" v-if="slot.default">
<slot></slot>
</span>
<span v-else-if="src" :class="classes">
<img :alt="alt" :src="src" />
</span>
<span v-else :class="classes">
<lay-icon :type="icon"></lay-icon>
<img v-if="src" :src="src" :alt="alt" />
<lay-icon v-else :type="icon" />
</span>
</template>

View File

@ -1,16 +1,15 @@
<script lang="ts">
import { computed, CSSProperties, useSlots, useAttrs } from "vue";
export default {
name: "LayAvatarList",
};
</script>
<script setup lang="ts">
const slot = useSlots();
</script>
<template>
<div class="layui-avatar-list">
<slot></slot>
</div>
</template>
</template>