perf: update listeners
parent
594dc07dff
commit
20ff3419e7
|
@ -1,6 +1,5 @@
|
|||
import Radio from './Radio';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import { getOptionProps } from '../_util/props-util';
|
||||
import { getOptionProps, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
export default {
|
||||
|
@ -22,7 +21,7 @@ export default {
|
|||
...otherProps,
|
||||
prefixCls,
|
||||
},
|
||||
on: { ...this.$listeners },
|
||||
on: getListeners(this),
|
||||
};
|
||||
if (this.radioGroupContext) {
|
||||
radioProps.on.change = this.radioGroupContext.onRadioChange;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { getOptionProps } from '../_util/props-util';
|
||||
import { getOptionProps, getListeners } from '../_util/props-util';
|
||||
import VcSlider from '../vc-slider/src/Slider';
|
||||
import VcRange from '../vc-slider/src/Range';
|
||||
import VcHandle from '../vc-slider/src/Handle';
|
||||
|
@ -117,6 +117,7 @@ const Slider = {
|
|||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('slider', customizePrefixCls);
|
||||
const tooltipPrefixCls = getPrefixCls('tooltip', customizeTooltipPrefixCls);
|
||||
const listeners = getListeners(this);
|
||||
if (range) {
|
||||
const vcRangeProps = {
|
||||
props: {
|
||||
|
@ -126,7 +127,7 @@ const Slider = {
|
|||
handle: info => this.handleWithTooltip(tooltipPrefixCls, info),
|
||||
},
|
||||
ref: 'sliderRef',
|
||||
on: this.$listeners,
|
||||
on: listeners,
|
||||
};
|
||||
return <VcRange {...vcRangeProps} />;
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ const Slider = {
|
|||
handle: info => this.handleWithTooltip(tooltipPrefixCls, info),
|
||||
},
|
||||
ref: 'sliderRef',
|
||||
on: this.$listeners,
|
||||
on: listeners,
|
||||
};
|
||||
return <VcSlider {...vcSliderProps} />;
|
||||
},
|
||||
|
|
|
@ -3,7 +3,12 @@ import VcTabs, { TabPane } from '../vc-tabs/src';
|
|||
import TabContent from '../vc-tabs/src/TabContent';
|
||||
import { isFlexSupported } from '../_util/styleChecker';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import { getComponentFromProp, getOptionProps, filterEmpty } from '../_util/props-util';
|
||||
import {
|
||||
getComponentFromProp,
|
||||
getOptionProps,
|
||||
filterEmpty,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import TabBar from './TabBar';
|
||||
|
@ -139,6 +144,7 @@ export default {
|
|||
) : null;
|
||||
|
||||
const renderTabBarSlot = renderTabBar || this.$scopedSlots.renderTabBar;
|
||||
const listeners = getListeners(this);
|
||||
const tabBarProps = {
|
||||
props: {
|
||||
...this.$props,
|
||||
|
@ -146,7 +152,7 @@ export default {
|
|||
tabBarExtraContent,
|
||||
renderTabBar: renderTabBarSlot,
|
||||
},
|
||||
on: this.$listeners,
|
||||
on: listeners,
|
||||
};
|
||||
const contentCls = {
|
||||
[`${prefixCls}-${tabPosition}-content`]: true,
|
||||
|
@ -165,7 +171,7 @@ export default {
|
|||
__propsSymbol__: Symbol(),
|
||||
},
|
||||
on: {
|
||||
...this.$listeners,
|
||||
...listeners,
|
||||
change: this.handleChange,
|
||||
},
|
||||
class: cls,
|
||||
|
|
|
@ -7,7 +7,7 @@ import Tree, { TreeProps } from './Tree';
|
|||
import { calcRangeKeys, getFullKeyList } from './util';
|
||||
import Icon from '../icon';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { initDefaultProps, getOptionProps } from '../_util/props-util';
|
||||
import { initDefaultProps, getOptionProps, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
// export type ExpandAction = false | 'click' | 'dblclick'; export interface
|
||||
|
@ -186,10 +186,8 @@ export default {
|
|||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('tree', customizePrefixCls);
|
||||
const { _expandedKeys: expandedKeys, _selectedKeys: selectedKeys } = this.$data;
|
||||
warning(
|
||||
!this.$listeners.doubleclick,
|
||||
'`doubleclick` is deprecated. please use `dblclick` instead.',
|
||||
);
|
||||
const listeners = getListeners(this);
|
||||
warning(!listeners.doubleclick, '`doubleclick` is deprecated. please use `dblclick` instead.');
|
||||
const treeProps = {
|
||||
props: {
|
||||
icon: getIcon,
|
||||
|
@ -201,7 +199,7 @@ export default {
|
|||
ref: 'tree',
|
||||
class: `${prefixCls}-directory`,
|
||||
on: {
|
||||
...omit(this.$listeners, ['update:selectedKeys']),
|
||||
...omit(listeners, ['update:selectedKeys']),
|
||||
select: this.onSelect,
|
||||
click: this.onClick,
|
||||
dblclick: this.onDoubleClick,
|
||||
|
|
|
@ -3,7 +3,7 @@ import uniqBy from 'lodash/uniqBy';
|
|||
import findIndex from 'lodash/findIndex';
|
||||
import VcUpload from '../vc-upload';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { getOptionProps, initDefaultProps, hasProp } from '../_util/props-util';
|
||||
import { getOptionProps, initDefaultProps, hasProp, getListeners } from '../_util/props-util';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import defaultLocale from '../locale-provider/default';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
@ -212,8 +212,9 @@ export default {
|
|||
remove: this.handleManualRemove,
|
||||
},
|
||||
};
|
||||
if (this.$listeners.preview) {
|
||||
uploadListProps.on.preview = this.$listeners.preview;
|
||||
const listeners = getListeners(this);
|
||||
if (listeners.preview) {
|
||||
uploadListProps.on.preview = listeners.preview;
|
||||
}
|
||||
return <UploadList {...uploadListProps} />;
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@ import addEventListener from '../_util/Dom/addEventListener';
|
|||
import { isWindow, buffer, isSamePoint, isSimilarValue, restoreFocus } from './util';
|
||||
import { cloneElement } from '../_util/vnode.js';
|
||||
import clonedeep from 'lodash/cloneDeep';
|
||||
import { getSlot } from '../_util/props-util';
|
||||
import { getSlot, getListeners } from '../_util/props-util';
|
||||
|
||||
function getElement(func) {
|
||||
if (typeof func !== 'function' || !func) return null;
|
||||
|
@ -117,7 +117,7 @@ export default {
|
|||
const { disabled, target, align } = this.$props;
|
||||
if (!disabled && target) {
|
||||
const source = this.$el;
|
||||
|
||||
const listeners = getListeners(this);
|
||||
let result;
|
||||
const element = getElement(target);
|
||||
const point = getPoint(target);
|
||||
|
@ -133,7 +133,7 @@ export default {
|
|||
}
|
||||
restoreFocus(activeElement, source);
|
||||
this.aligned = true;
|
||||
this.$listeners.align && this.$listeners.align(source, result);
|
||||
listeners.align && listeners.align(source, result);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
|
|||
import Trigger from '../vc-trigger';
|
||||
import { placements } from './placements';
|
||||
import Content from './Content';
|
||||
import { hasProp, getComponentFromProp, getOptionProps } from '../_util/props-util';
|
||||
import { hasProp, getComponentFromProp, getOptionProps, getListeners } from '../_util/props-util';
|
||||
function noop() {}
|
||||
export default {
|
||||
props: {
|
||||
|
@ -69,6 +69,7 @@ export default {
|
|||
if (hasProp(this, 'visible')) {
|
||||
extraProps.popupVisible = this.$props.visible;
|
||||
}
|
||||
const listeners = getListeners(this);
|
||||
const triggerProps = {
|
||||
props: {
|
||||
popupClassName: overlayClassName,
|
||||
|
@ -89,9 +90,9 @@ export default {
|
|||
...extraProps,
|
||||
},
|
||||
on: {
|
||||
...this.$listeners,
|
||||
popupVisibleChange: this.$listeners.visibleChange || noop,
|
||||
popupAlign: this.$listeners.popupAlign || noop,
|
||||
...listeners,
|
||||
popupVisibleChange: listeners.visibleChange || noop,
|
||||
popupAlign: listeners.popupAlign || noop,
|
||||
},
|
||||
ref: 'trigger',
|
||||
};
|
||||
|
|
|
@ -2,7 +2,13 @@ import Vue from 'vue';
|
|||
import ref from 'vue-ref';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import contains from '../_util/Dom/contains';
|
||||
import { hasProp, getComponentFromProp, getEvents, filterEmpty } from '../_util/props-util';
|
||||
import {
|
||||
hasProp,
|
||||
getComponentFromProp,
|
||||
getEvents,
|
||||
filterEmpty,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { requestAnimationTimeout, cancelAnimationTimeout } from '../_util/requestAnimationTimeout';
|
||||
import addEventListener from '../_util/Dom/addEventListener';
|
||||
import warning from '../_util/warning';
|
||||
|
@ -448,7 +454,8 @@ export default {
|
|||
sPopupVisible,
|
||||
});
|
||||
}
|
||||
this.$listeners.popupVisibleChange && this.$listeners.popupVisibleChange(sPopupVisible);
|
||||
const listeners = getListeners(this);
|
||||
listeners.popupVisibleChange && listeners.popupVisibleChange(sPopupVisible);
|
||||
}
|
||||
// Always record the point position since mouseEnterDelay will delay the show
|
||||
if (sPopupVisible && alignPoint && event) {
|
||||
|
|
Loading…
Reference in New Issue