bugfix: 参数传递改为用sessionStorage
This commit is contained in:
@@ -594,13 +594,18 @@
|
||||
if (!validatePublishRequired()) return
|
||||
|
||||
await handleSaveForm(status)
|
||||
|
||||
// 从 sessionStorage 获取参数
|
||||
const paramsStr = sessionStorage.getItem('listingEditParams')
|
||||
const params = paramsStr ? JSON.parse(paramsStr) : {}
|
||||
|
||||
if (status === "draft") {
|
||||
ROUTER.push({
|
||||
name: "Status",
|
||||
params: { status: "draft" },
|
||||
state: {
|
||||
type: history.state?.type,
|
||||
collectionId: history.state?.collectionId
|
||||
type: params.type,
|
||||
collectionId: params.collectionId
|
||||
}
|
||||
})
|
||||
} else if (status === "publish") {
|
||||
@@ -608,8 +613,8 @@
|
||||
name: "Status",
|
||||
params: { status: "publish" },
|
||||
state: {
|
||||
type: history.state?.type,
|
||||
collectionId: history.state?.collectionId
|
||||
type: params.type,
|
||||
collectionId: params.collectionId
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -642,12 +647,15 @@
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const data = history.state
|
||||
// 从 sessionStorage 获取参数
|
||||
const paramsStr = sessionStorage.getItem('listingEditParams')
|
||||
const data = paramsStr ? JSON.parse(paramsStr) : {}
|
||||
|
||||
if (data?.type === "edit") {
|
||||
itemId.value = history.state?.id
|
||||
itemId.value = data?.id
|
||||
handleGetDetailById()
|
||||
} else {
|
||||
const designItemIds = history.state?.designItemIds || []
|
||||
const designItemIds = data?.designItemIds || []
|
||||
|
||||
if (!designItemIds.length) return
|
||||
|
||||
@@ -659,6 +667,7 @@
|
||||
// console.log("list", list.length, list)
|
||||
handleFetchItemDetial(list)
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user