Getting Started
The Vue.js component to display single flash message or multiple flash messages to user. It has styles presets, but can be easily customized by passing style object as argument.
Installation
Use your package manager to install the package
## Install via npm
npm i @smartweb/vue-flash-message
## Install via yarn
yarn add @smartweb/vue-flash-message
Setup and Configuration in Vue project
Register the component in your app entry point (main.js or as you called it)
import Vue from 'vue';
import FlashMessage from '@smartweb/vue-flash-message';
Vue.use(FlashMessage);
You can pass configuration object as second argument
Vue.use(FlashMessage, config);
Setup and Configuration in Nuxt project
Create vue-flash-message.js file in plugins directory and put the following code
import Vue from 'vue';
import VueFlashMessage from '@smartweb/vue-flash-message';
Vue.use(VueFlashMessage);
In your nuxt.config.js file register your plugin
{
/* Since Nuxt.js 2.4, mode has been introduced as option of plugins to specify plugin type, possible value are: client or server. ssr: false will be adapted to mode: 'client' and deprecated in next major release.
More info: https://nuxtjs.org/guide/plugins#client-side-only */
plugins: [{ src: '~/plugins/flash-message.js', mode: 'client' }]
},
Last updated
Was this helpful?