mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-27 02:36:06 +01:00
Add Notification vue component
This commit is contained in:
parent
5290f9f57c
commit
b40fc65120
@ -4,8 +4,8 @@
|
||||
<h1 class="title" v-html="title" v-if="title"></h1>
|
||||
<slot />
|
||||
<p v-if="showTag">
|
||||
<div class="notification is-danger" v-if="fail" v-html="fail" />
|
||||
<div class="notification is-success" v-if="success" v-html="success" />
|
||||
<notification :message="fail" type="is-danger" v-if="fail" />
|
||||
<notification :message="success" type="is-success" v-if="success" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
45
resources/js/components/Notification.vue
Normal file
45
resources/js/components/Notification.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="notification" :class="type" v-if="show">
|
||||
<button class="delete" v-if="isDeletable" @click="close"></button>
|
||||
{{ message }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Notification',
|
||||
|
||||
data() {
|
||||
return {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'is-primary'
|
||||
},
|
||||
|
||||
message: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
isDeletable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
close (event) {
|
||||
if (event) {
|
||||
this.show = false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
2
resources/js/components/index.js
vendored
2
resources/js/components/index.js
vendored
@ -6,6 +6,7 @@ import FormField from './FormField'
|
||||
import FormSelect from './FormSelect'
|
||||
import FormSwitch from './FormSwitch'
|
||||
import FormButtons from './FormButtons'
|
||||
import Notification from './Notification'
|
||||
import VueFooter from './Footer'
|
||||
|
||||
// Components that are registered globaly.
|
||||
@ -17,6 +18,7 @@ import VueFooter from './Footer'
|
||||
FormSelect,
|
||||
FormSwitch,
|
||||
FormButtons,
|
||||
Notification,
|
||||
VueFooter,
|
||||
].forEach(Component => {
|
||||
Vue.component(Component.name, Component)
|
||||
|
Loading…
Reference in New Issue
Block a user