Giter Site home page Giter Site logo

Comments (6)

shakee93 avatar shakee93 commented on May 18, 2024

You can use this.$router.resolve({ name : 'your-route-name', params : { user_id : 10 } }).href to get the url of the route. take a look at official docs here router.resolve : http://router.vuejs.org/en/api/router-instance.html

from vue-toasted.

miladr avatar miladr commented on May 18, 2024

I know that but using
<a href="/users/10">Milad</a>
causes page refresh.

from vue-toasted.

shakee93 avatar shakee93 commented on May 18, 2024

Oh yes !! that will be a problem. the toast doesnt use the vue template engine it just uses plain javascript to build the html content. ill take a look if that is possible to make the component work.

although on your case you can attach an event listener to the <a> and use the vue-router push method to navigate to the location.

let toast = this.$toasted
    .show('<p>User <a href="">Milad</a> Successfully Created !!</p>');

toast.el
    .getElementsByTagName('a')[0]
    .addEventListener('click', (e) => {
        e.preventDefault();

        // in here redirect the user via $router
})

hope that helps. PR's are always welcome

from vue-toasted.

miladr avatar miladr commented on May 18, 2024

Do you think using "slot" is an option?

from vue-toasted.

shakee93 avatar shakee93 commented on May 18, 2024

Yeah it can be option if it is built via the vue template engine. but the toast is generated by plain javascript. thats the problem.

from vue-toasted.

shakee93 avatar shakee93 commented on May 18, 2024

and also please take a look at globalToasts feature. if the problem is reusing the toast again and again with that large code. this might help to resolve it.

https://github.com/shakee93/vue-toasted#reusable-global-toasts

from vue-toasted.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.