all files / src/flexbox/ flexbox.vue

0% Statements 0/1
100% Branches 0/0
100% Functions 0/0
0% Lines 0/1
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 58 59 60 61 62 63 64 65 66 67 68 69 70                                                                                                                                           
<template>
  <div class="mu-flexbox" :class="{'mu-flex-col': orient === 'vertical', 'mu-flex-row': orient === 'horizontal'}" :style="styles">
    <slot></slot>
  </div>
</template>
 
<script>
export default {
  name: 'mu-flexbox',
  props: {
    gutter: {
      type: Number,
      default: 8
    },
    orient: {
      type: String,
      default: 'horizontal'
    },
    justify: String,
    align: String,
    wrap: String
  },
  computed: {
    styles () {
      return {
        'justify-content': this.justify,
        'align-items': this.align,
        'flex-wrap': this.wrap
      }
    }
  }
}
</script>
 
<style lang="less">
.mu-flexbox{
  width: 100%;
  text-align: left;
  display: flex;
  box-align: center;
  align-items: center;
}
.mu-flexbox .mu-flexbox-item {
  flex: 1;
  min-width: 20px;
  width: 0%;
}
.mu-flexbox-item > .mu-flexbox {
  width: 100%;
}
.mu-flexbox .mu-flexbox-item:first-child{
  margin-left: 0!important;
  margin-top: 0!important;
}
.mu-flex-col {
  box-orient: vertical;
  flex-direction: column;
}
 
.mu-flex-col > .mu-flexbox-item {
  width: 100%;
}
 
.mu-flex-row {
  box-direction: row;
  box-orient: horizontal;
  flex-direction: row;
}
</style>