You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
import baseComponent from '../helpers/baseComponent' |
|
import classNames from '../helpers/classNames' |
|
|
|
baseComponent({ |
|
relations: { |
|
'../step/index': { |
|
type: 'child', |
|
observer() { |
|
this.debounce(this.updateCurrent) |
|
}, |
|
}, |
|
}, |
|
properties: { |
|
prefixCls: { |
|
type: String, |
|
value: 'wux-steps', |
|
}, |
|
current: { |
|
type: Number, |
|
value: 0, |
|
observer: 'updateCurrent', |
|
}, |
|
// status: { |
|
// type: String, |
|
// value: '', |
|
// }, |
|
direction: { |
|
type: String, |
|
value: 'horizontal', |
|
}, |
|
}, |
|
methods: { |
|
updateCurrent() { |
|
const elements = this.getRelationNodes('../step/index') |
|
const { current, direction } = this.data |
|
|
|
if (elements.length > 0) { |
|
elements.forEach((element, index) => { |
|
element.updateCurrent({ |
|
length: elements.length, |
|
index, |
|
current, |
|
direction, |
|
}) |
|
}) |
|
} |
|
}, |
|
}, |
|
})
|
|
|