all files / src/stepper/ step.vue

0% Statements 0/10
0% Branches 0/8
0% Functions 0/1
0% Lines 0/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57                                                                                                                 
<script>
export default {
  name: 'mu-step',
  props: {
    active: {
      type: Boolean,
      default: false
    },
    completed: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    index: {
      type: Number
    },
    last: {
      type: Boolean,
      default: false
    }
  },
  render (h) {
    const {active, completed, disabled, index, last} = this
    const children = []
    if (this.$slots.default && this.$slots.default.length > 0) {
      this.$slots.default.forEach((vNode) => {
        if (!vNode.componentOptions || !vNode.componentOptions.propsData) return
        const num = index + 1
        vNode.componentOptions.propsData = Object.assign({active, completed, disabled, last, num}, vNode.componentOptions.propsData)
        children.push(vNode)
      })
    }
    return h('div', {
      class: 'mu-step'
    }, children)
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-step{
  flex: 0 0 auto;
  margin-left: -6px;
  .mu-stepper-vertical & {
    margin-top: -14px;
    margin-left: 0;
  }
  &:first-child {
    margin-left: 0;
  }
}
</style>