question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to pass dynamic params to Vue router

See original GitHub issue

I need to be able to pass params along to Vue router when clicking a Toasted action button. I can’t seem to find any documentation on how to accomplish this. Here’s what I have:

Vue.toasted.register( "showSpecialAlert", payload => { // message if (!payload.holdName) { return "No hold selected"; } return "Generating activity for " + payload.holdName; }, { // options position: "top-center", keepOnHover: true, duration: 5000, action: { text: "View", push: { name: "showHold", // THIS DOESN'T WORK holdId: payload.holdId // NEITHER DOES THIS params: { holdId: payload.holdId } // NO ERROR IN CODE, BUT NOT DYNAMIC AND DOESN'T SHOW UP IN VUE DEV TOOLS params: { holdId: 2 } //// } } } );

Edit: code looks bad here; Replit link: https://repl.it/@BoClifton/Pass-Vue-Router-route-in-global-Toasted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MrTheSoulzcommented, Nov 26, 2019

same issue, options could maybe be a function like message? we recive payload, extend it and return it back.

0reactions
shakee93commented, Jul 31, 2020

@MrTheSoulz Hey for this scenario you will need to use the normal toast warapped inside a function.

myToast(payload){
  Vue.toasted.show("my message", {
    // your options here
    action : payload.action
  })
}

// and to call
myToast({
   // your payload
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic Route Matching with Params - Vue Router
Vue Router uses its own path matching syntax, inspired by the one used by express , so it supports many advanced matching patterns...
Read more >
Pass dynamic data to router-link. - Stack Overflow
Directly using variable with router-link. To use variables in a router link, all you have to do is this: <router-link :to=" ...
Read more >
Dynamic routing using Vue Router - LogRocket Blog
Dynamic routing using Vue Router ; Update the router/ ; Restart your app and head to localhost: ; For example, suppose that we...
Read more >
Vue JS 3 tutorial #39 Dynamic Routing - YouTube
With this vue 3 js tutorial, we learn routing in Vue js 3. ... What is Dynamic Routing Pass params with routing Get...
Read more >
Vue Router Dynamic Routes - A Vue.js Lesson From our Vue ...
In this lesson, we'll learn how to work with dynamic routes in Vue router. We'll learn how to declare the dynamic routes and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found