all files / src/toast/ toast.vue

0% Statements 0/2
100% Branches 0/0
100% Functions 0/0
0% Lines 0/2
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                                                                                                                                                                       
<template>
<transition name="mu-toast">
  <div class="mu-toast" v-clickoutside="clickOutSide" :style="{'z-index': zIndex}">
    {{message}}
  </div>
</transition>
</template>
 
<script>
import {getZIndex} from '../internal/popup/utils'
import clickoutside from '../internal/clickoutside'
export default {
  name: 'mu-toast',
  props: {
    message: {
      type: String
    }
  },
  methods: {
    clickOutSide () {
      this.$emit('close', 'clickOutSide')
    }
  },
  data () {
    return {
      zIndex: getZIndex()
    }
  },
  directives: {
    clickoutside
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-toast {
  height: 48px;
  line-height: 48px;
  padding: 0 24px;
  background-color: @textColor;
  color: @alternateTextColor;
  border-radius: 24px;
  .ellipsis();
  max-width: 568px;
  width: 100%;
  position: fixed;
  left: 0;
  bottom: 0;
}
 
 
@media only screen and (max-width: 992px) and (min-width: 601px) {
  .mu-toast {
    width: auto;
    min-width: 288px;
    left: 5%;
    bottom: 7%;
  }
}
@media only screen and (min-width: 993px) {
  .mu-toast {
    width: auto;
    min-width: 8%;
    top: 10%;
    right: 7%;
    left: auto;
    bottom: auto;
    min-width: 288px;
  }
}
 
.mu-toast-enter-active,.mu-toast-leave-active{
  transition: transform .4s @easeOutFunction, opacity .4s @easeOutFunction;
  backface-visibility: hidden;
}
 
.mu-toast-enter,
.mu-toast-leave-active{
  transform: translate3d(0, 100%, 0);
  opacity: 0;
}
</style>