Skip to content

olivierdrot/vue-flash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vue Flash

Heavily based upon the work by Jeffrey Way at Laracasts. If you are interested in learning more about the lesson this package is based upon you may view it in his Let's Build A Forum With Laravel course. I highly recommend anyone interested in Vue or Laravel subscribe to Laracasts, it's the best $9 a month you can spend.

Setup

    /**
     * Vue is a modern JavaScript library for building interactive web interfaces
     * using reactive data binding and reusable components. Vue's API is clean
     * and simple, leaving you to focus on building your next great project.
     */
    window.Vue = require('vue/dist/vue.js');
    
    /**
     * Our Vuejs event handler which we will be using for flash messaging
     * @type {Vue}
     */
    window.events = new Vue();
    
    /**
     * Our Flash function which will be used to add new flash events to our event handler
     * 
     * @param  String message Our alert message
     * @param  String type    The type of alert we want to show
     */
    window.flash = function(message, type) {
        window.events.$emit('flash', message, type);
    };
    
    Vue.component('flash', require('vue-flash'));
    
    var app = new Vue({
        el: '#app',
    }).$mount();

Usage

flash('Hello World', 'success');
flash('Hello World', 'error');
flash('Hello World', 'warning');
flash('Hello World', 'info');

Props

Name Type Default Restrictions
timeout Number 3000
transition String slide-fade fade, slide-fade, bounce
bulma Boolean false
icon Boolean false

License

Vue-Flash is open-sourced software licensed under the MIT license.

About

A flash messaging component for Vue.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 71.3%
  • Vue 28.7%