[Vuejs]-How can I show notification message after redirect a page in Nuxt.js?

0👍

I also had the same problem and here is my workaround.

On the middleware file, return redirect to the desired page then add an optional query parameter that you would check against on the desired page when it loads. then on conditional check against that query parameter, you pop up a notification. You can use noty plugin to display the notification.

So in summary…

//In middleware file
return('/to/desired/page?queryName=queryValue')

//In Desired Page file
<script>
...
mounted(){
   if(this.$route.query.queryName == queryValue){
     
    this.$noty.error('your notification message here')
    // or .info  or .warning ...check the link for more
  }
}
...
</script>

Leave a comment