3.3.1 • Published 4 years ago

@nuxtjs/toast v3.3.1

Weekly downloads
18,199
License
MIT
Repository
github
Last release
4 years ago

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')
         }
     }  
   }
}
3.3.1

4 years ago

3.3.0

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.2

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago