bugfix: 面包屑导航
This commit is contained in:
@@ -8,8 +8,9 @@ type SellerRouteMetaValue<T> = T | ((route: RouteLocationNormalizedLoaded) => T)
|
||||
type SellerBreadcrumbItem = {
|
||||
title?: SellerRouteMetaValue<string>
|
||||
titleKey?: SellerRouteMetaValue<string>
|
||||
to?: SellerRouteMetaValue<RouteLocationRaw>
|
||||
to?: SellerRouteMetaValue<RouteLocationRaw | undefined>
|
||||
}
|
||||
type SellerBreadcrumbList = SellerRouteMetaValue<SellerBreadcrumbItem[]>
|
||||
|
||||
const myListingsBreadcrumb: SellerBreadcrumbItem = {
|
||||
title: "My Listings",
|
||||
@@ -20,7 +21,16 @@ const selectCollectionBreadcrumb: SellerBreadcrumbItem = {
|
||||
to: { name: "myListingsSelect" }
|
||||
}
|
||||
const selectSketchBreadcrumb: SellerBreadcrumbItem = {
|
||||
title: "Select Sketch"
|
||||
title: "Select Sketch",
|
||||
to: (route) => {
|
||||
const collectionId =
|
||||
route.params.collectionId ||
|
||||
(typeof history !== "undefined" ? history.state?.collectionId : "")
|
||||
|
||||
return collectionId
|
||||
? { name: "myListingsSelectItem", params: { collectionId } }
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
const editListingBreadcrumb: SellerBreadcrumbItem = {
|
||||
title: "Edit Listing Details"
|
||||
@@ -31,6 +41,22 @@ const statusBreadcrumb: SellerBreadcrumbItem = {
|
||||
? "SellerListEdit.listingLive"
|
||||
: "SellerListEdit.draftSaved"
|
||||
}
|
||||
const createListingBreadcrumbs: SellerBreadcrumbItem[] = [
|
||||
myListingsBreadcrumb,
|
||||
selectCollectionBreadcrumb,
|
||||
selectSketchBreadcrumb,
|
||||
editListingBreadcrumb
|
||||
]
|
||||
const isEditingListingFromList = () =>
|
||||
typeof history !== "undefined" && history.state?.type === "edit"
|
||||
const editListingBreadcrumbs: SellerBreadcrumbList = () =>
|
||||
isEditingListingFromList()
|
||||
? [myListingsBreadcrumb, editListingBreadcrumb]
|
||||
: createListingBreadcrumbs
|
||||
const listingStatusBreadcrumbs: SellerBreadcrumbList = () =>
|
||||
isEditingListingFromList()
|
||||
? [myListingsBreadcrumb, editListingBreadcrumb, statusBreadcrumb]
|
||||
: [...createListingBreadcrumbs, statusBreadcrumb]
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
@@ -273,12 +299,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
meta: {
|
||||
enter: "all",
|
||||
sellerHeaderTitle: "Edit Listing Details",
|
||||
sellerBreadcrumbs: [
|
||||
myListingsBreadcrumb,
|
||||
selectCollectionBreadcrumb,
|
||||
selectSketchBreadcrumb,
|
||||
editListingBreadcrumb
|
||||
]
|
||||
sellerBreadcrumbs: editListingBreadcrumbs
|
||||
},
|
||||
component: () =>
|
||||
import("@/views/SellerDashboard/MyListings/EditDetail/index.vue")
|
||||
@@ -289,13 +310,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
meta: {
|
||||
enter: "all",
|
||||
sellerHeaderTitle: "Edit Listing Details",
|
||||
sellerBreadcrumbs: [
|
||||
myListingsBreadcrumb,
|
||||
selectCollectionBreadcrumb,
|
||||
selectSketchBreadcrumb,
|
||||
editListingBreadcrumb,
|
||||
statusBreadcrumb
|
||||
]
|
||||
sellerBreadcrumbs: listingStatusBreadcrumbs
|
||||
},
|
||||
component: () =>
|
||||
import("@/views/SellerDashboard/MyListings/EditDetail/Status.vue")
|
||||
|
||||
Reference in New Issue
Block a user