Skip to content

Commit

Permalink
fix(block-diff): 修复区块发布是查看差异保存时schema出错的bug (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
betterdancing committed May 6, 2024
1 parent 50b6237 commit 3107621
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/common/component/BlockDeployDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:modal="false"
:fullscreen="true"
:append-to-body="true"
title="Schema 本地与线上差异"
title="Schema 线上与本地差异"
>
<vue-monaco
v-if="state.compareVisible"
Expand Down Expand Up @@ -82,8 +82,9 @@ import {
FormItem as TinyFormItem
} from '@opentiny/vue'
import { theme } from '@opentiny/tiny-engine-controller/adapter'
import { useLayout } from '@opentiny/tiny-engine-controller'
import { useLayout, useNotify } from '@opentiny/tiny-engine-controller'
import { getSchema, setSchema } from '@opentiny/tiny-engine-canvas'
import { constants } from '@opentiny/tiny-engine-utils'
import VueMonaco from './VueMonaco.vue'
export default {
Expand All @@ -106,6 +107,7 @@ export default {
},
emits: ['update:visible'],
setup(props, { emit, attrs }) {
const { COMPONENT_NAME } = constants
const formState = reactive({
deployInfo: '',
version: '',
Expand Down Expand Up @@ -212,10 +214,20 @@ export default {
}
const save = () => {
const pageSchema = JSON.parse(state.newCode)
setSchema(pageSchema)
close()
if (!state.newCode) {
close()
return
}
try {
const pageSchema = JSON.parse(state.newCode)
setSchema({ ...pageSchema, componentName: COMPONENT_NAME.Block })
close()
} catch (err) {
useNotify({
type: 'error',
message: '代码静态检查有错误,请先修改后再保存'
})
}
}
return {
Expand Down

0 comments on commit 3107621

Please sign in to comment.