This repository was archived by the owner on Apr 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +80
-1
lines changed Expand file tree Collapse file tree 7 files changed +80
-1
lines changed Original file line number Diff line number Diff line change 4949 "simple-line-icons" : " ^2.4.1" ,
5050 "vue" : " ^2.5.16" ,
5151 "vue-chartjs" : " ^3.3.2" ,
52+ "vue-notification" : " ^1.3.10" ,
5253 "vue-router" : " ^3.0.1" ,
5354 "vuejs-datepicker" : " ^1.5.2" ,
5455 "vuex" : " ^3.0.1"
Original file line number Diff line number Diff line change 33 <AppHeader />
44 <div class =" app-body" >
55 <Sidebar :nav-items =" nav" />
6+ <notifications
7+ class =" custom-notifications"
8+ :style =" { 'margin-top': offset }" />
69 <main class =" main" >
710 <breadcrumb :list =" list" />
811 <div class =" container-fluid" >
@@ -30,7 +33,8 @@ export default {
3033 },
3134 data () {
3235 return {
33- nav: nav .items ,
36+ nav : nav .items ,
37+ offset: true ,
3438 }
3539 },
3640 computed: {
@@ -41,5 +45,19 @@ export default {
4145 return this .$route .matched
4246 },
4347 },
48+ methods: {
49+ setPosNotify () {
50+ const top = $ (document ).scrollTop ()
51+ const offset = top < 55 ? 55 - top : 0
52+
53+ this .offset = ` ${ offset} px`
54+ },
55+ },
56+ mounted () {
57+ $ (window ).on (' scroll' , this .setPosNotify )
58+ },
59+ beforeDestroy () {
60+ $ (window ).off (' scroll' , this .setPosNotify )
61+ },
4462}
4563 </script >
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ import Vue from 'vue'
44import BootstrapVue from 'bootstrap-vue'
55import Datepicker from 'vuejs-datepicker'
66import { id } from 'vuejs-datepicker/dist/locale'
7+ import Notifications from 'vue-notification'
78import App from './App'
89import router from './router'
910import store from './store'
1011
1112Vue . use ( BootstrapVue )
13+ Vue . use ( Notifications )
1214
1315Vue . component ( 'b-datepicker' , {
1416 extends : Datepicker ,
Original file line number Diff line number Diff line change 209209 </div >
210210 </b-card >
211211 </b-col >
212+ <b-col
213+ cols =" 12"
214+ md =" 6" >
215+ <b-card
216+ header-tag =" header"
217+ footer-tag =" footer" >
218+ <div slot =" header" >
219+ <i class =" fa fa-align-justify" /> Alerts <small >with <b >Vue Notification</b ></small >
220+ </div >
221+ <b-button
222+ variant =" success"
223+ @click =" showNotify('success')" >
224+ Success
225+ </b-button >
226+ <b-button
227+ variant =" warning"
228+ @click =" showNotify('warning')" >
229+ Warning
230+ </b-button >
231+ <b-button
232+ variant =" danger"
233+ @click =" showNotify('danger')" >
234+ Danger
235+ </b-button >
236+ </b-card >
237+ </b-col >
212238 </b-row >
213239 </div >
214240 </div >
@@ -231,6 +257,13 @@ export default {
231257 showAlert () {
232258 this .dismissCountDown = this .dismissSecs
233259 },
260+ showNotify (type ) {
261+ this .$notify ({
262+ type,
263+ title: ' Important message' ,
264+ text : ' Hello user! This is a notification!' ,
265+ })
266+ },
234267 },
235268}
236269 </script >
Original file line number Diff line number Diff line change @@ -31,3 +31,4 @@ $simple-line-font-path: '~simple-line-icons/fonts/';
3131
3232// Custom styles
3333@import ' custom' ;
34+ @import ' vendors/vue-notification/notification' ;
Original file line number Diff line number Diff line change 1+ .vue-notification {
2+ & .warning {
3+ background : #ffb648 ;
4+ border-left-color : #f48a06 ;
5+ }
6+
7+ & .danger {
8+ background : #E54D42 ;
9+ border-left-color : #B82E24 ;
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments