perf: update some attrs

This commit is contained in:
tangjinzhou 2020-01-18 17:06:09 +08:00
parent 3cb68f5ec6
commit 8b6b506110
9 changed files with 10 additions and 8 deletions

View File

@ -23,7 +23,7 @@ export default function wrapWithConnect(WrappedComponent) {
}, },
}, },
render() { render() {
const { $listeners, $slots = {}, $attrs, $scopedSlots } = this; const { $listeners, $slots = {}, $scopedSlots } = this;
const props = getOptionProps(this); const props = getOptionProps(this);
const wrapProps = { const wrapProps = {
props: { props: {
@ -33,7 +33,6 @@ export default function wrapWithConnect(WrappedComponent) {
children: $slots.default || props.children || [], children: $slots.default || props.children || [],
}, },
on: $listeners, on: $listeners,
attrs: $attrs,
}; };
if (Object.keys($scopedSlots).length) { if (Object.keys($scopedSlots).length) {
wrapProps.scopedSlots = $scopedSlots; wrapProps.scopedSlots = $scopedSlots;

View File

@ -81,7 +81,7 @@ export default function connect(mapStateToProps) {
}, },
render() { render() {
this.preProps = { ...this.$props }; this.preProps = { ...this.$props };
const { $listeners, $slots = {}, $attrs, $scopedSlots, subscribed, store } = this; const { $listeners, $slots = {}, $scopedSlots, subscribed, store } = this;
const props = getOptionProps(this); const props = getOptionProps(this);
this.preProps = { ...omit(props, ['__propsSymbol__']) }; this.preProps = { ...omit(props, ['__propsSymbol__']) };
const wrapProps = { const wrapProps = {
@ -91,7 +91,6 @@ export default function connect(mapStateToProps) {
store, store,
}, },
on: $listeners, on: $listeners,
attrs: $attrs,
scopedSlots: $scopedSlots, scopedSlots: $scopedSlots,
}; };
return ( return (

View File

@ -46,7 +46,6 @@ export default {
pull, pull,
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
$slots, $slots,
$attrs,
$listeners, $listeners,
rowContext, rowContext,
} = this; } = this;
@ -82,7 +81,6 @@ export default {
}; };
const divProps = { const divProps = {
on: $listeners, on: $listeners,
attrs: $attrs,
class: classes, class: classes,
style: {}, style: {},
}; };

View File

@ -14,6 +14,7 @@ const ActionMap = {
export default { export default {
name: 'AInputPassword', name: 'AInputPassword',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false,
model: { model: {
prop: 'value', prop: 'value',
event: 'change.value', event: 'change.value',

View File

@ -30,6 +30,7 @@ function noop() {}
export default { export default {
name: 'ATextarea', name: 'ATextarea',
inheritAttrs: false,
model: { model: {
prop: 'value', prop: 'value',
event: 'change.value', event: 'change.value',

View File

@ -62,6 +62,6 @@ exports[`renders ./components/input/demo/size.md correctly 1`] = `<div class="co
exports[`renders ./components/input/demo/textarea.md correctly 1`] = `<textarea placeholder="Basic usage" rows="4" class="ant-input"></textarea>`; exports[`renders ./components/input/demo/textarea.md correctly 1`] = `<textarea placeholder="Basic usage" rows="4" class="ant-input"></textarea>`;
exports[`renders ./components/input/demo/textarea-resize.md correctly 1`] = `<div><button type="button" class="ant-btn" style="margin-bottom: 16px;"><span>Auto Resize: {String(autoResize)}</span></button> <textarea rows="4" class="ant-input"></textarea></div>`; exports[`renders ./components/input/demo/textarea-resize.md correctly 1`] = `<div><button type="button" class="ant-btn" style="margin-bottom: 16px;"><span>Auto Resize: false</span></button> <textarea rows="4" class="ant-input"></textarea></div>`;
exports[`renders ./components/input/demo/tooltip.md correctly 1`] = `<input placeholder="Input a number" type="text" maxlength="25" class="ant-input" style="width: 120px;">`; exports[`renders ./components/input/demo/tooltip.md correctly 1`] = `<input placeholder="Input a number" type="text" maxlength="25" class="ant-input" style="width: 120px;">`;

View File

@ -12,7 +12,7 @@ For multi-line input.
<template> <template>
<div> <div>
<a-button style="margin-bottom: 16px" @click="() => this.autoResize = !autoResize"> <a-button style="margin-bottom: 16px" @click="() => this.autoResize = !autoResize">
Auto Resize: {String(autoResize)} Auto Resize: {{String(autoResize)}}
</a-button> </a-button>
<a-textarea :rows="4" :autosize="autoResize" :defaultValue="defaultValue" /> <a-textarea :rows="4" :autosize="autoResize" :defaultValue="defaultValue" />
</div> </div>

View File

@ -75,6 +75,7 @@ export const destroyFns = [];
export default { export default {
name: 'AModal', name: 'AModal',
inheritAttrs: false,
model: { model: {
prop: 'visible', prop: 'visible',
event: 'change', event: 'change',
@ -161,6 +162,7 @@ export default {
centered, centered,
$listeners, $listeners,
$slots, $slots,
$attrs,
} = this; } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
@ -197,6 +199,7 @@ export default {
}, },
class: getClass(this), class: getClass(this),
style: getStyle(this), style: getStyle(this),
attrs: $attrs,
}; };
return <Dialog {...dialogProps}>{$slots.default}</Dialog>; return <Dialog {...dialogProps}>{$slots.default}</Dialog>;
}, },

View File

@ -5,6 +5,7 @@ import { getStyle, getClass } from '../_util/props-util';
const IDialogPropTypes = getDialogPropTypes(); const IDialogPropTypes = getDialogPropTypes();
let openCount = 0; let openCount = 0;
const DialogWrap = { const DialogWrap = {
inheritAttrs: false,
props: { props: {
...IDialogPropTypes, ...IDialogPropTypes,
visible: IDialogPropTypes.visible.def(false), visible: IDialogPropTypes.visible.def(false),