all files / src/bottomNav/ bottomNav.vue

0% Statements 0/14
0% Branches 0/14
0% Functions 0/2
0% Lines 0/14
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 71 72 73 74 75 76 77 78 79 80 81 82                                                                                                                                                                   
<script>
import abstractButton from '../internal/abstractButton'
export default {
  name: 'mu-bottom-nav',
  props: {
    shift: {
      type: Boolean,
      default: false
    },
    value: {}
  },
  methods: {
    handleItemClick (value, item) {
      if (value !== this.value) {
        this.$emit('change', value)
      }
      this.$emit('itemClick', item)
      this.$emit('item-click', item)
    },
    setChildrenInstance () {
      var children = this.$slots.default
      children.forEach((vNode) => {
        if (vNode && vNode.child && vNode.child.isBottomNavItem) {
          vNode.child.bottomNav = this
        }
      })
    }
  },
  mounted () {
    this.setChildrenInstance()
  },
  updated () {
    var children = this.$slots.default
    children.forEach((vNode) => {
      if (vNode && vNode.child && vNode.child.isBottomNavItem) {
        vNode.child.bottomNav = this
      }
    })
  },
  render (h) {
    return h(abstractButton, {
      class: ['mu-bottom-nav', this.shift ? 'mu-bottom-nav-shift' : undefined],
      props: {
        disableTouchRipple: !this.shift,
        centerRipple: false,
        wrapperClass: 'mu-bottom-nav-shift-wrapper',
        containerElement: 'div',
        rippleOpacity: 0.3
      }
    }, this.$slots.default)
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-bottom-nav{
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: @dialogBackgroundColor;
  text-align: center;
  position: relative;
  width: 100%;
  color: @alternateTextColor;
}
 
.mu-bottom-nav-shift{
  background-color: @primaryColor;
}
 
.mu-bottom-nav-shift-wrapper{
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
</style>