Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@nuxtjs/toast

nuxt50kMIT3.3.1TypeScript support: included

readme

Toast

npm npm (scoped with tag)

😍 Responsive Touch Compatible Toast plugin for Nuxt.js using vue-toasted

Setup

  • Add @nuxtjs/toast dependency using yarn or npm to your project
  • Add @nuxtjs/toast to compilerOptions/types section of tsconfig.json to add typescript support [optional]
  • Add @nuxtjs/toast to modules section of nuxt.config.js
{
  modules: [
   '@nuxtjs/toast',
  ],

  toast: {
      position: 'top-center',
      register: [ // Register custom toasts
        {
          name: 'my-error',
          message: 'Oops...Something went wrong',
          options: {
            type: 'error'
          }
        }
      ]
  }
}

If you need material icons, you have to manually install material-design-icons dependency too.

Usage

You can use $toast (instead of $toasted) in almost any context using app.$toast or this.$toast (Including store actions).

See toasted official docs for more usage information.

export default {
   methods:{
     async login() {
         try {
             this.$toast.show('Logging in...')
             await this.$axios.$post('auth/login')
             this.$toast.success('Successfully authenticated')
         } catch(e){
             this.$toast.global.my_error() //Using custom toast
             this.$toast.error('Error while authenticating')
         }
     }  
   }
}

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.3.1 (2020-07-14)

Note: Version bump only for package @nuxtjs/toast

3.3.0 (2019-11-01)

Features

  • toast: add $toast type definition to vuex context and application options (#326) (936d0a2)

3.2.1 (2019-05-28)

Bug Fixes

3.2.0 (2019-05-18)

Features

3.1.0 (2019-04-15)

Features

  • toast: add ability to register custom toasts (#271) (b9ecbbd)

3.0.2 (2018-12-19)

Bug Fixes

  • deps: update all non-major dependencies (#231) (345418b)

3.0.1 (2018-04-27)

Note: Version bump only for package @nuxtjs/toast

3.0.0 (2018-03-05)

misc

  • toast: use default toast options. fixes #186. (9fd9b61)

BREAKING CHANGES

  • toast: some default options are changed back to their original values

2.3.3 (2017-11-27)

Note: Version bump only for package @nuxtjs/toast

2.3.2 (2017-11-27)

Note: Version bump only for package @nuxtjs/toast

2.3.1 (2017-11-20)

Note: Version bump only for package @nuxtjs/toast

2.3.0 (2017-09-06)

Features

  • toast: remove material-design-icons dependency (5554a2d), closes #134

2.2.1 (2017-09-04)

Bug Fixes

  • toast: correct options serialization (3efc32a)

2.2.0 (2017-09-04)

Features

  • toast: provide default options (31ca728)

2.1.0 (2017-09-04)

Features

2.0.0 (2017-09-04)

Features

BREAKING CHANGES

  • toast: api has been changed

1.0.2 (2017-06-10)

1.0.1 (2017-05-29)

1.0.0 (2017-05-26)

Features

  • initial migration to 1.0.0-alpha1 (05c1b7a)

BREAKING CHANGES

  • New modules system is backward incompatible with nuxt-helpers style modules

0.0.1 (2017-05-10)