perf: divider
parent
4320e8dc76
commit
72668faa25
|
@ -1,6 +1,7 @@
|
|||
import { inject } from 'vue';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import { getSlot } from '../_util/props-util';
|
||||
|
||||
const Divider = {
|
||||
name: 'ADivider',
|
||||
|
@ -16,23 +17,21 @@ const Divider = {
|
|||
};
|
||||
},
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, type, $slots, dashed, orientation = 'center' } = this;
|
||||
const { prefixCls: customizePrefixCls, type, dashed, orientation = 'center' } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('divider', customizePrefixCls);
|
||||
const orientationPrefix = orientation.length > 0 ? '-' + orientation : orientation;
|
||||
|
||||
const children = getSlot(this);
|
||||
const classString = {
|
||||
[prefixCls]: true,
|
||||
[`${prefixCls}-${type}`]: true,
|
||||
[`${prefixCls}-with-text${orientationPrefix}`]: $slots.default,
|
||||
[`${prefixCls}-with-text${orientationPrefix}`]: children.length,
|
||||
[`${prefixCls}-dashed`]: !!dashed,
|
||||
};
|
||||
|
||||
return (
|
||||
<div class={classString} role="separator">
|
||||
{$slots.default && $slots.default() && (
|
||||
<span class={`${prefixCls}-inner-text`}>{$slots.default()}</span>
|
||||
)}
|
||||
{!!children.length && <span class={`${prefixCls}-inner-text`}>{children}</span>}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import demo from '../antdv-demo/docs/descriptions/demo/index';
|
||||
import demo from '../antdv-demo/docs/divider/demo/index';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
Loading…
Reference in New Issue