@@ -237,33 +237,47 @@ export const notifierPlugin = {
237237 } )
238238 }
239239
240- Vue . prototype . $showNotification = function ( config ) {
241- let countNotify = store . getters . countNotify
242- countNotify ++
243- store . commit ( 'SET_COUNT_NOTIFY' , countNotify )
244- const defaultConfig = {
240+ Vue . prototype . $notification = {
241+ defaultConfig : {
245242 top : '65px' ,
246243 onClose : ( ) => {
247244 let countNotify = store . getters . countNotify
248245 countNotify > 0 ? countNotify -- : countNotify = 0
249246 store . commit ( 'SET_COUNT_NOTIFY' , countNotify )
250247 }
251- }
252- config = Object . assign ( { } , defaultConfig , config )
253- switch ( config . type ) {
254- case 'info' :
255- notification . info ( config )
256- break
257- case 'error' :
258- notification . error ( config )
259- break
260- case 'success' :
261- notification . success ( config )
262- break
263- case 'warning' :
264- notification . warning ( config )
265- break
266- }
248+ } ,
249+ setCountNotify : ( ) => {
250+ let countNotify = store . getters . countNotify
251+ countNotify ++
252+ store . commit ( 'SET_COUNT_NOTIFY' , countNotify )
253+ } ,
254+ info : ( config ) => {
255+ Vue . prototype . $notification . setCountNotify ( )
256+ config = Object . assign ( { } , Vue . prototype . $notification . defaultConfig , config )
257+ notification . info ( config )
258+ } ,
259+ error : ( config ) => {
260+ Vue . prototype . $notification . setCountNotify ( )
261+ config = Object . assign ( { } , Vue . prototype . $notification . defaultConfig , config )
262+ notification . error ( config )
263+ } ,
264+ success : ( config ) => {
265+ Vue . prototype . $notification . setCountNotify ( )
266+ config = Object . assign ( { } , Vue . prototype . $notification . defaultConfig , config )
267+ notification . success ( config )
268+ } ,
269+ warning : ( config ) => {
270+ Vue . prototype . $notification . setCountNotify ( )
271+ config = Object . assign ( { } , Vue . prototype . $notification . defaultConfig , config )
272+ notification . warning ( config )
273+ } ,
274+ warn : ( config ) => {
275+ Vue . prototype . $notification . setCountNotify ( )
276+ config = Object . assign ( { } , Vue . prototype . $notification . defaultConfig , config )
277+ notification . warn ( config )
278+ } ,
279+ close : ( key ) => notification . close ( key ) ,
280+ destroy : ( ) => notification . destroy ( )
267281 }
268282 }
269283}
0 commit comments