birdpaper-ui
Version:
一个通用的 vue3 UI组件库。A common vue3 UI component library.
34 lines (33 loc) • 848 B
JavaScript
import { defineComponent, computed } from "vue";
const _sfc_main = defineComponent({
name: "Avatar",
props: {
/** 头像图标资源地址 */
imgSrc: { type: String, default: "" },
/** 图片适应类型 */
fit: { type: String, default: "fill" },
/** 头像形状 */
shape: { type: String, default: "circle" },
/** 头像尺寸 */
size: { type: [String, Number], default: "normal" }
},
emits: ["click"],
setup: function(props, { emit, slots }) {
const name = "bp-avatar";
const cls = computed(() => {
let clsName;
clsName = [name, `${name}-shape-${props.shape}`, `${name}-size-${props.size}`];
return clsName;
});
const handleClick = () => emit("click");
return {
name,
cls,
slots,
handleClick
};
}
});
export {
_sfc_main as default
};