You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
797 B
42 lines
797 B
4 years ago
|
<template>
|
||
|
<div class="alert" :style="`top: ${top}px`">
|
||
|
<slot></slot>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: 'Alert',
|
||
|
props: ['show'],
|
||
|
data() {
|
||
|
return {
|
||
|
top: 100
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
console.log(this)
|
||
|
// this.$page.alert = this.$page.alert ? this.$page.alert : {top: 100}
|
||
|
// this.$page.alert.top += 20
|
||
|
// this.top = this.$page.alert.top
|
||
|
setTimeout(() => {
|
||
|
this.$el.remove()
|
||
|
}, 1000)
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
.alert{
|
||
|
position: absolute;
|
||
|
padding: 6px 8px;
|
||
|
background-color: #f0f2f5;
|
||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||
|
border-radius: 4px;
|
||
|
margin: 0 auto;
|
||
|
z-index: 999;
|
||
|
top: 100px;
|
||
|
width: fit-content;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
}
|
||
|
</style>
|