fix: steps not fire some event

This commit is contained in:
tanjinzhou 2020-06-22 16:26:10 +08:00
parent 65f49b97d7
commit 923e6231e4
4 changed files with 7 additions and 13 deletions

View File

@ -215,7 +215,7 @@ const getPropsData = vnode => {
res[k] = v;
}
});
return res;
return { ...props, ...res }; // 合并事件、未声明属性等
};
const getValueByProp = (ele, prop) => {
return getPropsData(ele)[prop];

View File

@ -2,7 +2,7 @@ import { inject } from 'vue';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
import PropTypes from '../_util/vue-types';
import { initDefaultProps, getOptionProps, getComponent } from '../_util/props-util';
import { initDefaultProps, getOptionProps, getComponent, getSlot } from '../_util/props-util';
import VcSteps from '../vc-steps';
import { ConfigConsumerProps } from '../config-provider';
@ -52,7 +52,7 @@ const Steps = {
progressDot,
...props,
};
return <VcSteps {...stepsProps}>{this.$slots.default && this.$slots.default()}</VcSteps>;
return <VcSteps {...stepsProps}>{getSlot(this)}</VcSteps>;
},
};

View File

@ -33,12 +33,7 @@ export default {
},
methods: {
onItemClick(...args) {
const { onClick } = this.$props;
if (onClick) {
this.$emit('click', ...args);
}
this.$emit('click', ...args);
this.$emit('stepClick', this.stepIndex);
},
renderIconNode() {

View File

@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
import debounce from 'lodash/debounce';
import isFlexSupported from '../_util/isFlexSupported';
import { filterEmpty } from '../_util/props-util';
import { filterEmpty, getSlot, getPropsData } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
export default {
@ -98,14 +98,13 @@ export default {
status,
size,
current,
$slots,
progressDot,
initial,
icons,
} = this;
const isNav = type === 'navigation';
const { lastStepOffsetWidth, flexSupported } = this;
const filteredChildren = filterEmpty($slots.default && $slots.default());
const filteredChildren = filterEmpty(getSlot(this));
const lastIndex = filteredChildren.length - 1;
const adjustedlabelPlacement = progressDot ? 'vertical' : labelPlacement;
const classString = {
@ -124,7 +123,7 @@ export default {
return (
<div {...stepsProps}>
{filteredChildren.map((child, index) => {
const childProps = child.props || {};
const childProps = getPropsData(child);
const stepNumber = initial + index;
const stepProps = {
stepNumber: `${stepNumber + 1}`,