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(),
},
});
},