P粉7859057972023-08-04 12:52:00
I don't think there is currently such a way, but if there is, it cannot be considered optional. I recommend simply passing in the string 'all' if filters.getId() is empty.
updateRoute(): void {
const filters = this.filters;
const router = this.$router;
let routeId = filters.getId()
if (!routeId && filters.handedSlug()) {
routeId = 'all'
}
router.push({
name: 'Person',
params: {
id: routeId,
handedSlug: filters.handedSlug(),
},
});
},