| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { use } from '../utils';
- import Icon from '../icon';
- var _use = use('step'),
- sfc = _use[0],
- bem = _use[1];
- export default sfc({
- beforeCreate: function beforeCreate() {
- var steps = this.$parent.steps;
- var index = this.$parent.slots().indexOf(this.$vnode);
- steps.splice(index === -1 ? steps.length : index, 0, this);
- },
- beforeDestroy: function beforeDestroy() {
- var index = this.$parent.steps.indexOf(this);
- if (index > -1) {
- this.$parent.steps.splice(index, 1);
- }
- },
- computed: {
- status: function status() {
- var index = this.$parent.steps.indexOf(this);
- var active = this.$parent.active;
- if (index < active) {
- return 'finish';
- }
- if (index === active) {
- return 'process';
- }
- }
- },
- render: function render(h) {
- var _ref;
- var status = this.status;
- var _this$$parent = this.$parent,
- activeIcon = _this$$parent.activeIcon,
- activeColor = _this$$parent.activeColor,
- direction = _this$$parent.direction;
- var titleStyle = status === 'process' && {
- color: activeColor
- };
- return h("div", {
- "class": ['van-hairline', bem([direction, (_ref = {}, _ref[status] = status, _ref)])]
- }, [h("div", {
- "class": bem('title'),
- "style": titleStyle
- }, [this.slots()]), h("div", {
- "class": bem('circle-container')
- }, [status !== 'process' ? h("i", {
- "class": bem('circle')
- }) : this.slots('active-icon') || h(Icon, {
- "attrs": {
- "name": activeIcon
- },
- "style": {
- color: activeColor
- }
- })]), h("div", {
- "class": bem('line')
- })]);
- }
- });
|