Skip to content

Commit

Permalink
feat(page): use meta options injection methods to each component of p…
Browse files Browse the repository at this point in the history
…age module;
  • Loading branch information
betterdancing committed Oct 30, 2024
1 parent 48687e8 commit 5b86799
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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)
}
requestCreatePage(createParams)
.then((data) => {
Expand Down

0 comments on commit 5b86799

Please sign in to comment.