all files / src/pagination/ pageItem.vue

0% Statements 0/7
0% Branches 0/2
100% Functions 0/0
0% Lines 0/7
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106                                                                                                                                                                                                                   
<template>
<abstract-button  class="mu-pagination-item" wrapperClass="mu-pagination-item-wrapper" :class="{'circle': isCircle, 'active': isActive}":centerRipple="false" :disabled="disabled"
  @click="handleClick"  @hover="handleHover" @hoverExit="handleHoverExit" containerElement="div">
  <span v-if="index">{{index}}</span>
  <slot></slot>
</abstract-button>
</template>
 
<script>
import abstractButton from '../internal/abstractButton'
export default{
  props: {
    icon: {
      type: String
    },
    index: {
      type: Number
    },
    isCircle: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    isActive: {
      type: Boolean,
      default: false
    },
    identifier: {
      type: String
    }
  },
  data () {
    return {
    }
  },
  methods: {
    handleHover (event) {
      this.$emit('hover', event)
    },
    handleHoverExit (event) {
      this.$emit('hoverExit', event)
      this.$emit('hover-exit', event)
    },
    handleClick () {
      if (this.index) {
        this.$emit('click', this.index)
      } else {
        this.$emit('click', this.identifier)
      }
    }
  },
  components: {
    'abstract-button': abstractButton
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-pagination-item {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  height: 32px;
  min-width: 32px;
  padding-left: 8px;
  padding-right: 8px;
  line-height: 32px;
  margin: 0 8px;
  transition: all .45s @easeOutFunction;
  color: @textColor;
  position: relative;
  cursor: pointer;
  border-radius: 2px;
  &.hover {
    background-color: rgba(0, 0, 0, .1);
  }
  &.active {
    color: @white;
    background-color: @primaryColor;
  }
  &.disabled {
    color: @disabledColor;
    cursor: not-allowed;
  }
  &.circle{
    border-radius: 50%;
    .mu-ripple-wrapper {
      border-radius: 50%;
    }
  }
}
 
.mu-pagination-item-wrapper {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
  justify-content: center;
}
</style>