VueJS CRUD - Form Notifications

The notification component will be used to display an alert to the user either success or error. This component requires data to be passed into it via props, this allows us to get the notification data from the forms and pass in the messages to be displayed. To add props to the component we just need to add the option props.

props: ['notifications']

The HTML will then loop through the notifications data props add the Twitter bootstrap classes of either alert alert-success or alert alert-danger, then display the message of the notification.

    <div id="notifications">
        <div v-for="notification in notifications" :class="getNotificationClass(notification)">
            {{ notification.message }}

    export default{


        methods: {
            getNotificationClass: function(notification)
                return 'alert alert-' + notification.type;

        props: ['notifications']


Reliable uptime monitoring and instant alerts for any website downtime.

Get 50% off forever using the code 50OFFUP.