Reputation: 662
In my application toolbar I want to show a back button when the user is on /manage/*. If a user is on /manage or /other the back button should not show.
Here's my computed property to return true:false if the user is on /manage/*
computed: {
showBackButton: function() {
return this.$route.path === "/manage/*";
}
}
The wildcards in the regex documentation on the vue-router site do not seem the work. According to the documentation, * is the correct wildcard to use.
Upvotes: 0
Views: 595
Reputation: 16344
Your code is making a type and value comparison, javascript does not work with regex by default... If you want to work with regex, I would rather try something like:
computed: {
showBackButton: function() {
return this.$route.path.match(/^\/manage\/.*$/);
}
}
Upvotes: 1