<template>
    <view :class="['cu-avatar',round?'round':'',radius?'radius':'',size,'bg-'+bg]"
          :style="{backgroundImage:'url('+url+')'}">
        <slot></slot>
    </view>
</template>
<script>
export default {
    name: "cuAvatar",
    props: {
        /***
         * 头像地址
         * @param url
         */
        url: {
            type: String,
            defualt: () => ''
        },
        /**
         * 头像形状
         * @param round
         */
        round: {
            type: Boolean,
            default: () => false
        },
        /**
         * 头像形状扁平
         * @parma radius
         */
        radius: {
            type: Boolean,
            default: () => false
        },
        /**
         * 头像大小
         * @param size
         */
        size: {
            type: String,
            default: () => 'sm'
        },
        /**
         * 无头像时的背景颜色
         * @param bg
         */
        bg: {
            type: String,
            default: () => ''
        }
    }
}
</script>