| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- exports.__esModule = true;
- exports["default"] = void 0;
- var _utils = require("../utils");
- var _icon = _interopRequireDefault(require("../icon"));
- var _use = (0, _utils.use)('step'),
- sfc = _use[0],
- bem = _use[1];
- var _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["default"], {
- "attrs": {
- "name": activeIcon
- },
- "style": {
- color: activeColor
- }
- })]), h("div", {
- "class": bem('line')
- })]);
- }
- });
- exports["default"] = _default;
|