Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/plugins/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import entry, { api } from './src/Main.vue'
import metaData from './meta.js'
import { PageService } from './src/composable'
import PageGeneral from './src/PageGeneral.vue'
import { api as pageSettingApi } from './src/PageSetting.vue'

export default {
...metaData,
apis: { ...api, ...pageSettingApi },
apis: api,
entry,
components: {
PageGeneral
Expand Down
9 changes: 4 additions & 5 deletions packages/plugins/page/src/PageSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ const PAGE_SETTING_SESSION = {
history: 'history'
}

export const api = {
beforeCreatePage: async () => {}
}

export default {
components: {
TinyButton: Button,
Expand Down Expand Up @@ -137,6 +133,7 @@ export default {
const { confirm } = useModal()
const registry = getMergeRegistry(meta.type, meta.id)
const pageGeneral = registry.components.PageGeneral
const beforeCreatePage = registry?.options?.beforeCreatePage
const pageGeneralRef = ref(null)

const state = reactive({
Expand Down Expand Up @@ -182,7 +179,9 @@ export default {
delete createParams.id
delete createParams._id
}
await api.beforeCreatePage(createParams)
if (beforeCreatePage) {
await beforeCreatePage(createParams)
}
Comment thread
betterdancing marked this conversation as resolved.

requestCreatePage(createParams)
.then((data) => {
Expand Down