Skip to content

Commit

Permalink
fix: 修复常规发布返回问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 5, 2023
1 parent b770962 commit b7adffa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/components/common/BackPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ const props = defineProps({
// datas
const showBack = ref(query.showBack === "true")
// emits
const emit = defineEmits(["backEmit"])
const onBack = () => {
router.back()
if (emit) {
emit("backEmit")
} else {
router.back()
}
}
</script>

Expand Down
18 changes: 15 additions & 3 deletions src/components/publish/SinglePublishDoPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<script setup lang="ts">
import { markRaw, onMounted, reactive } from "vue"
import { useRoute } from "vue-router"
import { useRoute, useRouter } from "vue-router"
import BackPage from "~/src/components/common/BackPage.vue"
import { usePublish } from "~/src/composables/usePublish.ts"
import { MethodEnum } from "~/src/models/methodEnum.ts"
Expand All @@ -48,6 +48,7 @@ const { doInitPage } = usePublish()
const { query } = useRoute()
const { kernelApi } = useSiyuanApi()
const { doSinglePublish, doSingleDelete } = usePublish()
const router = useRouter()
// datas
const params = reactive(route.params)
Expand Down Expand Up @@ -206,6 +207,17 @@ const initPage = async () => {
}
}
const onBack = () => {
const path = `/publish/singlePublish`
logger.info("will go to =>", path)
const query = {
path: path,
query: {
id: id,
},
}
router.push(query)
}
onMounted(async () => {
logger.info("获取到的ID为=>", id)
Expand All @@ -215,7 +227,7 @@ onMounted(async () => {
</script>

<template>
<back-page title="常规发布">
<back-page title="常规发布" @backEmit="onBack">
<el-skeleton class="placeholder" v-if="!formData.isInit" :rows="5" animated />
<div v-else id="batch-publish-index">
<el-alert class="top-tip" :title="getTitle()" type="info" :closable="false" />
Expand Down Expand Up @@ -302,4 +314,4 @@ onMounted(async () => {
.top-tip
margin-top 10px
padding-left 0
</style>
</style>

0 comments on commit b7adffa

Please sign in to comment.