mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-15 09:21:25 +08:00
61 lines
1.4 KiB
Vue
61 lines
1.4 KiB
Vue
|
|
import PropTypes from '../_util/vue-types'
|
|
import { initDefaultProps, getOptionProps, getComponentFromProp } from '../_util/props-util'
|
|
import VcSteps from '../vc-steps'
|
|
|
|
const getStepsProps = (defaultProps = {}) => {
|
|
const props = {
|
|
prefixCls: PropTypes.string,
|
|
iconPrefix: PropTypes.string,
|
|
current: PropTypes.number,
|
|
status: PropTypes.oneOf(['wait', 'process', 'finish', 'error']),
|
|
size: PropTypes.oneOf(['default', 'small']),
|
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
progressDot: PropTypes.oneOfType([
|
|
PropTypes.bool,
|
|
PropTypes.func,
|
|
]),
|
|
}
|
|
return initDefaultProps(props, defaultProps)
|
|
}
|
|
|
|
const Steps = {
|
|
name: 'ASteps',
|
|
props: getStepsProps({
|
|
prefixCls: 'ant-steps',
|
|
iconPrefix: 'ant',
|
|
current: 0,
|
|
}),
|
|
Step: { ...VcSteps.Step, name: 'AStep' },
|
|
render () {
|
|
const props = getOptionProps(this)
|
|
const stepsProps = {
|
|
props: {
|
|
...props,
|
|
icons: props.icons || {
|
|
error: getComponentFromProp(this, 'icons.error'),
|
|
finish: getComponentFromProp(this, 'icons.finish'),
|
|
},
|
|
},
|
|
on: this.$listeners,
|
|
scopedSlots: this.$scopedSlots,
|
|
}
|
|
return (
|
|
<VcSteps
|
|
{...stepsProps}
|
|
>
|
|
{this.$slots.default}
|
|
</VcSteps>
|
|
)
|
|
},
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
Steps.install = function (Vue) {
|
|
Vue.component(Steps.name, Steps)
|
|
Vue.component(Steps.Step.name, Steps.Step)
|
|
}
|
|
|
|
export default Steps
|
|
|