(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"> <span :class="classes" v-if="slot.default">
<slot></slot> <slot></slot>
</span> </span>
<span v-else-if="src" :class="classes">
<img :alt="alt" :src="src" />
</span>
<span v-else :class="classes"> <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> </span>
</template> </template>

View File

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