birdpaper-ui
Version:
一个通用的 vue3 UI组件库。A common vue3 UI component library.
33 lines (32 loc) • 842 B
JavaScript
;
const vue = require("vue");
const _sfc_main = vue.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 = vue.computed(() => {
let clsName;
clsName = [name, `${name}-shape-${props.shape}`, `${name}-size-${props.size}`];
return clsName;
});
const handleClick = () => emit("click");
return {
name,
cls,
slots,
handleClick
};
}
});
module.exports = _sfc_main;