refactor(style): destructuring style change to array (#5451)

pull/5457/head
bqy_fe 2022-04-08 10:04:31 +08:00 committed by GitHub
parent a41a9b086b
commit 34ebd55082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 33 deletions

View File

@ -168,7 +168,7 @@ const Alert = defineComponent({
<div
role="alert"
{...attrs}
style={{ ...(attrs.style as Object), ...motionStyle.value }}
style={[attrs.style, motionStyle.value]}
v-show={!closing.value}
class={[attrs.class, alertCls]}
data-show={!closing.value}

View File

@ -203,11 +203,7 @@ const Avatar = defineComponent({
{...attrs}
ref={avatarNodeRef}
class={classString}
style={{
...sizeStyle,
...responsiveSizeStyle(!!icon),
...(attrs.style as CSSProperties),
}}
style={[sizeStyle, responsiveSizeStyle(!!icon), attrs.style]}
>
{childrenToRender}
</span>

View File

@ -1,4 +1,4 @@
import type { CSSProperties, VNode } from 'vue';
import type { VNode } from 'vue';
import {
onMounted,
getCurrentInstance,
@ -110,13 +110,13 @@ const ResizableTextArea = defineComponent({
const cls = classNames(prefixCls, attrs.class, {
[`${prefixCls}-disabled`]: disabled,
});
const style = {
...(attrs.style as CSSProperties),
...textareaStyles.value,
...(resizeStatus.value === RESIZE_STATUS_RESIZING
const style = [
attrs.style,
textareaStyles.value,
resizeStatus.value === RESIZE_STATUS_RESIZING
? { overflowX: 'hidden', overflowY: 'hidden' }
: null),
};
: null,
];
const textareaProps: any = {
...otherProps,
...attrs,

View File

@ -193,13 +193,15 @@ export default defineComponent({
</div>
)
: null;
const divStyle = {
...(attrs.style as CSSProperties),
const divStyle = [
attrs.style,
{
flex: `0 0 ${siderWidth}`,
maxWidth: siderWidth, // Fix width transition bug in IE11
minWidth: siderWidth, // https://github.com/ant-design/ant-design/issues/6349
width: siderWidth,
};
},
];
const siderCls = classNames(
pre,
`${pre}-${theme}`,

View File

@ -63,7 +63,7 @@ export default defineComponent({
tabindex={active ? 0 : -1}
aria-labelledby={id && `${id}-tab-${tabKey}`}
aria-hidden={!active}
style={{ ...mergedStyle.value, ...(attrs.style as any) }}
style={[mergedStyle.value, attrs.style]}
class={[`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, attrs.class]}
>
{(active || visited.value || forceRender) && slots.default?.()}

View File

@ -1,4 +1,4 @@
import type { CSSProperties, PropType } from 'vue';
import type { PropType } from 'vue';
import { computed, defineComponent, ref, onMounted, onBeforeUnmount } from 'vue';
import classNames from '../../_util/classNames';
import PropTypes from '../../_util/vue-types';
@ -108,10 +108,7 @@ export default defineComponent({
'aria-valuenow': value,
'aria-disabled': !!disabled,
};
const elStyle = {
...(attrs.style as CSSProperties),
...positionStyle.value,
};
const elStyle = [attrs.style, positionStyle.value];
let mergedTabIndex = tabindex || 0;
if (disabled || tabindex === null) {
mergedTabIndex = null;

View File

@ -144,13 +144,16 @@ export default defineComponent({
} = props as PopupInnerProps;
const statusValue = status.value;
// ======================== Render ========================
const mergedStyle: CSSProperties = {
const mergedStyle: CSSProperties[] = [
{
...stretchStyle.value,
zIndex,
opacity: statusValue === 'motion' || statusValue === 'stable' || !visible.value ? null : 0,
opacity:
statusValue === 'motion' || statusValue === 'stable' || !visible.value ? null : 0,
pointerEvents: statusValue === 'stable' ? null : 'none',
...(attrs.style as object),
};
},
attrs.style,
];
let childNode: any = flattenChildren(slots.default?.({ visible: props.visible }));