Skip to content

Commit

Permalink
fix: (avatar) type error
Browse files Browse the repository at this point in the history
  • Loading branch information
backrunner committed Jun 5, 2024
1 parent db5e492 commit 4b9c54d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/packages/avatar/AAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import type { StyleValue } from 'vue';
import { computed } from 'vue';
import { PREDEFINED_SIZE, type AvatarSize } from './types';
import { AvatarSize, PREDEFINED_SIZE } from './types';
import type { EnumValues } from '@/utils/types';
const props = defineProps<{
src: string;
size: EnumValues<typeof AvatarSize>;
size?: EnumValues<typeof AvatarSize>;
width?: number | string;
round?: boolean;
}>();
Expand All @@ -26,7 +26,7 @@ const handleError = (event: Event) => {
};
const styles = computed<StyleValue>(() => {
const sizeValue = PREDEFINED_SIZE[props.size];
const sizeValue = PREDEFINED_SIZE[props.size || AvatarSize.Medium];
const widthValue = props.width ?? `${sizeValue}px`;
return {
Expand Down
12 changes: 6 additions & 6 deletions src/testground/sections/avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<div class="testground-content__item">
<p class="testground-content-title">Avatar</p>
<div class="container">
<a-avatar src="https://0.gravatar.com/avatar/" size="xlarge" round />
<a-avatar src="https://0.gravatar.com/avatar/" size="large" />
<a-avatar src="https://0.gravatar.com/avatar/" size="medium" :width="40" />
<a-avatar src="https://0.gravatar.com/avatar/" size="small" width="50px" round />
<a-avatar src="https://0.gravatar.com/avatar/" size="xsmall" />
<a-avatar src="https://0.gravatar.com/avatar/" :size="AvatarSize.Large" round />
<a-avatar src="https://0.gravatar.com/avatar/" :size="AvatarSize.Medium" />
<a-avatar src="https://0.gravatar.com/avatar/" :width="40" />
<a-avatar src="https://0.gravatar.com/avatar/" width="50px" round />
<a-avatar src="https://0.gravatar.com/avatar/" :size="AvatarSize.XSmall" />
</div>
</div>
</template>

<script setup lang="ts">
import { Avatar as AAvatar } from '../../';
import { Avatar as AAvatar, AvatarSize } from '../../';
</script>

<style lang="scss" scoped>
Expand Down

0 comments on commit 4b9c54d

Please sign in to comment.