Browse Source

update Message component

pull/342/head
Guillaume Vincent 7 years ago
parent
commit
807762693f
1 changed files with 28 additions and 4 deletions
  1. +28
    -4
      src/components/Message.vue

+ 28
- 4
src/components/Message.vue View File

@@ -1,8 +1,12 @@
<style> <style>
.fade-enter-active, .fade-leave-active {
.fade-enter-active {
transition: opacity .5s transition: opacity .5s
} }


.fade-leave-active {
transition: opacity 2s
}

.fade-enter, .fade-leave-to { .fade-enter, .fade-leave-to {
opacity: 0 opacity: 0
} }
@@ -14,16 +18,27 @@
right: 0; right: 0;
z-index: 20; z-index: 20;
} }

.close-notification{
float: right;
position: absolute;
top:0;
right: 1em;
cursor: pointer;
}
</style> </style>
<template> <template>
<div id="message">
<div id="message" v-on:click="keepMessage">
<transition name="fade"> <transition name="fade">
<div v-if="message.text"> <div v-if="message.text">
<div class="card-header text-white" <div class="card-header text-white"
v-bind:class="{ 'card-warning': message.status==='warning', 'card-danger': message.status==='error', 'card-success': message.status==='success' }"> v-bind:class="{ 'card-warning': message.status==='warning', 'card-danger': message.status==='error', 'card-success': message.status==='success' }">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<small>message</small>
<small>{{message.text}}</small>
<span class="close-notification" v-on:click="hideMessage">
<i class="fa fa-close"></i>
</span>
</div> </div>
</div> </div>
</div> </div>
@@ -33,10 +48,19 @@
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
import message from '../services/message';


export default { export default {
computed: mapGetters([ computed: mapGetters([
'message' 'message'
])
]),
methods: {
keepMessage(){
message.keepMessage();
},
hideMessage(){
message.hideMessage();
}
}
} }
</script> </script>

Loading…
Cancel
Save