鍒濆鎻愪氦锛氱墰鍙暟鎹鐞嗙郴缁?- 鍖呭惈鍚庣Spring Boot鍜屽墠绔疺ue3椤圭洰
This commit is contained in:
71
admin-system/node_modules/element-plus/es/components/avatar/src/avatar2.mjs
generated
vendored
Normal file
71
admin-system/node_modules/element-plus/es/components/avatar/src/avatar2.mjs
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
|
||||
import { ElIcon } from '../../icon/index.mjs';
|
||||
import { avatarProps, avatarEmits } from './avatar.mjs';
|
||||
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
||||
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
||||
import { isString } from '@vue/shared';
|
||||
import { isNumber } from '../../../utils/types.mjs';
|
||||
import { addUnit } from '../../../utils/dom/style.mjs';
|
||||
|
||||
const __default__ = defineComponent({
|
||||
name: "ElAvatar"
|
||||
});
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
props: avatarProps,
|
||||
emits: avatarEmits,
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const ns = useNamespace("avatar");
|
||||
const hasLoadError = ref(false);
|
||||
const avatarClass = computed(() => {
|
||||
const { size, icon, shape } = props;
|
||||
const classList = [ns.b()];
|
||||
if (isString(size))
|
||||
classList.push(ns.m(size));
|
||||
if (icon)
|
||||
classList.push(ns.m("icon"));
|
||||
if (shape)
|
||||
classList.push(ns.m(shape));
|
||||
return classList;
|
||||
});
|
||||
const sizeStyle = computed(() => {
|
||||
const { size } = props;
|
||||
return isNumber(size) ? ns.cssVarBlock({
|
||||
size: addUnit(size) || ""
|
||||
}) : void 0;
|
||||
});
|
||||
const fitStyle = computed(() => ({
|
||||
objectFit: props.fit
|
||||
}));
|
||||
watch(() => props.src, () => hasLoadError.value = false);
|
||||
function handleError(e) {
|
||||
hasLoadError.value = true;
|
||||
emit("error", e);
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("span", {
|
||||
class: normalizeClass(unref(avatarClass)),
|
||||
style: normalizeStyle(unref(sizeStyle))
|
||||
}, [
|
||||
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
|
||||
key: 0,
|
||||
src: _ctx.src,
|
||||
alt: _ctx.alt,
|
||||
srcset: _ctx.srcSet,
|
||||
style: normalizeStyle(unref(fitStyle)),
|
||||
onError: handleError
|
||||
}, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
||||
default: withCtx(() => [
|
||||
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
||||
]),
|
||||
_: 1
|
||||
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
|
||||
], 6);
|
||||
};
|
||||
}
|
||||
});
|
||||
var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "avatar.vue"]]);
|
||||
|
||||
export { Avatar as default };
|
||||
//# sourceMappingURL=avatar2.mjs.map
|
||||
Reference in New Issue
Block a user