2018-02-15 12:29:59 +00:00
|
|
|
<template>
|
2018-09-05 04:47:26 +00:00
|
|
|
<div class="mk-notify" :class="pos">
|
2018-09-04 02:34:36 +00:00
|
|
|
<div>
|
|
|
|
<mk-notification-preview :notification="notification"/>
|
|
|
|
</div>
|
2018-02-15 12:29:59 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import * as anime from 'animejs';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['notification'],
|
2018-09-05 04:47:26 +00:00
|
|
|
computed: {
|
|
|
|
pos() {
|
|
|
|
return this.$store.state.device.mobileNotificationPosition;
|
|
|
|
}
|
|
|
|
},
|
2018-02-15 12:29:59 +00:00
|
|
|
mounted() {
|
2018-02-18 09:40:24 +00:00
|
|
|
this.$nextTick(() => {
|
2018-02-15 12:29:59 +00:00
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
2018-09-05 04:47:26 +00:00
|
|
|
[this.pos]: '0px',
|
2018-02-15 12:29:59 +00:00
|
|
|
duration: 500,
|
|
|
|
easing: 'easeOutQuad'
|
|
|
|
});
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
2018-09-05 04:47:26 +00:00
|
|
|
[this.pos]: `-${this.$el.offsetHeight}px`,
|
2018-02-15 12:29:59 +00:00
|
|
|
duration: 500,
|
|
|
|
easing: 'easeOutQuad',
|
|
|
|
complete: () => this.$destroy()
|
|
|
|
});
|
|
|
|
}, 6000);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.mk-notify
|
2018-09-04 10:19:51 +00:00
|
|
|
$height = 78px
|
|
|
|
|
2018-02-15 12:29:59 +00:00
|
|
|
position fixed
|
2018-09-14 03:39:11 +00:00
|
|
|
z-index 10000
|
2018-02-15 12:29:59 +00:00
|
|
|
left 0
|
2018-09-04 02:34:36 +00:00
|
|
|
right 0
|
2018-02-15 12:29:59 +00:00
|
|
|
width 100%
|
2018-09-04 02:34:36 +00:00
|
|
|
max-width 500px
|
2018-09-04 10:19:51 +00:00
|
|
|
height $height
|
2018-09-04 02:34:36 +00:00
|
|
|
margin 0 auto
|
|
|
|
padding 8px
|
2018-02-15 12:29:59 +00:00
|
|
|
pointer-events none
|
2018-09-04 02:34:36 +00:00
|
|
|
font-size 80%
|
|
|
|
|
2018-09-05 04:47:26 +00:00
|
|
|
&.bottom
|
|
|
|
bottom -($height)
|
|
|
|
|
|
|
|
&.top
|
|
|
|
top -($height)
|
|
|
|
|
2018-09-04 02:34:36 +00:00
|
|
|
> div
|
|
|
|
height 100%
|
|
|
|
-webkit-backdrop-filter blur(2px)
|
|
|
|
backdrop-filter blur(2px)
|
|
|
|
background-color rgba(#000, 0.5)
|
2018-09-04 10:19:51 +00:00
|
|
|
border-radius 7px
|
|
|
|
overflow hidden
|
2018-02-15 12:29:59 +00:00
|
|
|
|
|
|
|
</style>
|