mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 04:58:16 +08:00
a2f7d6d062
closes vueComponent/ant-design-vue#5765 Add `compatConfig: { MODE: 3 }` to all component definitions to signal to `@vue/compat` not to use any Vue 2 compatibility features.
42 lines
1.2 KiB
Vue
42 lines
1.2 KiB
Vue
import type { ExtractPropTypes, PropType } from 'vue';
|
|
import { computed, defineComponent } from 'vue';
|
|
import classNames from '../_util/classNames';
|
|
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
|
import Element, { skeletonElementProps } from './Element';
|
|
|
|
export const avatarProps = () => {
|
|
return {
|
|
...skeletonElementProps(),
|
|
shape: String as PropType<'circle' | 'square'>,
|
|
};
|
|
};
|
|
|
|
export type SkeletonAvatarProps = Partial<ExtractPropTypes<ReturnType<typeof avatarProps>>>;
|
|
|
|
const SkeletonAvatar = defineComponent({
|
|
compatConfig: { MODE: 3 },
|
|
name: 'ASkeletonAvatar',
|
|
props: initDefaultProps(avatarProps(), {
|
|
size: 'default',
|
|
shape: 'circle',
|
|
}),
|
|
setup(props) {
|
|
const { prefixCls } = useConfigInject('skeleton', props);
|
|
const cls = computed(() =>
|
|
classNames(prefixCls.value, `${prefixCls.value}-element`, {
|
|
[`${prefixCls.value}-active`]: props.active,
|
|
}),
|
|
);
|
|
return () => {
|
|
return (
|
|
<div class={cls.value}>
|
|
<Element {...props} prefixCls={`${prefixCls.value}-avatar`} />
|
|
</div>
|
|
);
|
|
};
|
|
},
|
|
});
|
|
|
|
export default SkeletonAvatar;
|