Vue click refresh route how to return to the current root directory

add this to refresh back to the home page

mounted:function(){
    this.$router.push("/home");
}

how to refresh back to the current route root

clipboard.png

clipboard.png

Feb.24,2022

mounted:function(){
    var path = this.$route.path.match(/^\/[^\/]*/)[0]
    this.$router.push(path);
}

you can get path using matched provided by router

mounted:function(){
    var path = this.$route.matched[1].path;
    this.$router.push(path);
}
Menu