fix: steps not fire some event
parent
65f49b97d7
commit
923e6231e4
|
@ -215,7 +215,7 @@ const getPropsData = vnode => {
|
||||||
res[k] = v;
|
res[k] = v;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return { ...props, ...res }; // 合并事件、未声明属性等
|
||||||
};
|
};
|
||||||
const getValueByProp = (ele, prop) => {
|
const getValueByProp = (ele, prop) => {
|
||||||
return getPropsData(ele)[prop];
|
return getPropsData(ele)[prop];
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { inject } from 'vue';
|
||||||
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
||||||
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
|
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
|
||||||
import PropTypes from '../_util/vue-types';
|
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 VcSteps from '../vc-steps';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ const Steps = {
|
||||||
progressDot,
|
progressDot,
|
||||||
...props,
|
...props,
|
||||||
};
|
};
|
||||||
return <VcSteps {...stepsProps}>{this.$slots.default && this.$slots.default()}</VcSteps>;
|
return <VcSteps {...stepsProps}>{getSlot(this)}</VcSteps>;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onItemClick(...args) {
|
onItemClick(...args) {
|
||||||
const { onClick } = this.$props;
|
this.$emit('click', ...args);
|
||||||
|
|
||||||
if (onClick) {
|
|
||||||
this.$emit('click', ...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$emit('stepClick', this.stepIndex);
|
this.$emit('stepClick', this.stepIndex);
|
||||||
},
|
},
|
||||||
renderIconNode() {
|
renderIconNode() {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import isFlexSupported from '../_util/isFlexSupported';
|
import isFlexSupported from '../_util/isFlexSupported';
|
||||||
import { filterEmpty } from '../_util/props-util';
|
import { filterEmpty, getSlot, getPropsData } from '../_util/props-util';
|
||||||
import { cloneElement } from '../_util/vnode';
|
import { cloneElement } from '../_util/vnode';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -98,14 +98,13 @@ export default {
|
||||||
status,
|
status,
|
||||||
size,
|
size,
|
||||||
current,
|
current,
|
||||||
$slots,
|
|
||||||
progressDot,
|
progressDot,
|
||||||
initial,
|
initial,
|
||||||
icons,
|
icons,
|
||||||
} = this;
|
} = this;
|
||||||
const isNav = type === 'navigation';
|
const isNav = type === 'navigation';
|
||||||
const { lastStepOffsetWidth, flexSupported } = this;
|
const { lastStepOffsetWidth, flexSupported } = this;
|
||||||
const filteredChildren = filterEmpty($slots.default && $slots.default());
|
const filteredChildren = filterEmpty(getSlot(this));
|
||||||
const lastIndex = filteredChildren.length - 1;
|
const lastIndex = filteredChildren.length - 1;
|
||||||
const adjustedlabelPlacement = progressDot ? 'vertical' : labelPlacement;
|
const adjustedlabelPlacement = progressDot ? 'vertical' : labelPlacement;
|
||||||
const classString = {
|
const classString = {
|
||||||
|
@ -124,7 +123,7 @@ export default {
|
||||||
return (
|
return (
|
||||||
<div {...stepsProps}>
|
<div {...stepsProps}>
|
||||||
{filteredChildren.map((child, index) => {
|
{filteredChildren.map((child, index) => {
|
||||||
const childProps = child.props || {};
|
const childProps = getPropsData(child);
|
||||||
const stepNumber = initial + index;
|
const stepNumber = initial + index;
|
||||||
const stepProps = {
|
const stepProps = {
|
||||||
stepNumber: `${stepNumber + 1}`,
|
stepNumber: `${stepNumber + 1}`,
|
||||||
|
|
Loading…
Reference in New Issue