2018-02-12 13:10:16 +01:00
|
|
|
<template>
|
|
|
|
<div class="mk-ui-notification">
|
|
|
|
<p>{{ message }}</p>
|
2018-02-13 00:24:44 +01:00
|
|
|
</div>
|
2018-02-12 13:10:16 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-02-13 01:27:57 +01:00
|
|
|
import * as anime from 'animejs';
|
2018-02-12 13:10:16 +01:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['message'],
|
|
|
|
mounted() {
|
2018-02-20 18:53:34 +01:00
|
|
|
this.$nextTick(() => {
|
2018-02-12 13:10:16 +01:00
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
2018-02-20 18:53:34 +01:00
|
|
|
opacity: 1,
|
|
|
|
translateY: [-64, 0],
|
|
|
|
easing: 'easeOutElastic',
|
|
|
|
duration: 500
|
2018-02-12 13:10:16 +01:00
|
|
|
});
|
2018-02-20 18:53:34 +01:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
|
|
|
opacity: 0,
|
|
|
|
translateY: -64,
|
|
|
|
duration: 500,
|
|
|
|
easing: 'easeInElastic',
|
|
|
|
complete: () => this.$destroy()
|
|
|
|
});
|
|
|
|
}, 6000);
|
|
|
|
});
|
2018-02-12 13:10:16 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-05-29 04:38:24 +02:00
|
|
|
root(isDark)
|
2018-02-12 13:10:16 +01:00
|
|
|
display block
|
|
|
|
position fixed
|
|
|
|
z-index 10000
|
|
|
|
top -128px
|
|
|
|
left 0
|
|
|
|
right 0
|
|
|
|
margin 0 auto
|
|
|
|
padding 128px 0 0 0
|
|
|
|
width 500px
|
2018-05-29 04:38:24 +02:00
|
|
|
color rgba(isDark ? #fff : #000, 0.6)
|
|
|
|
background rgba(isDark ? #282C37 : #fff, 0.9)
|
2018-02-12 13:10:16 +01:00
|
|
|
border-radius 0 0 8px 8px
|
2018-05-29 04:38:24 +02:00
|
|
|
box-shadow 0 2px 4px rgba(#000, isDark ? 0.4 : 0.2)
|
2018-02-12 13:10:16 +01:00
|
|
|
transform translateY(-64px)
|
|
|
|
opacity 0
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0
|
|
|
|
line-height 64px
|
|
|
|
text-align center
|
|
|
|
|
2018-05-29 04:38:24 +02:00
|
|
|
.mk-ui-notification[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.mk-ui-notification:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
2018-02-12 13:10:16 +01:00
|
|
|
</style>
|