P粉7859057972023-08-04 12:52:00
我认为目前没有这种方式,但如果有的话,它不能被视为可选项。我建议如果filters.getId()为空,只需简单地传入字符串'all'。
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(),
},
});
},