Skip to content

Commit

Permalink
fix: 优化 ma-codeEditor 组件
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo committed Dec 30, 2023
1 parent 0a134bc commit 1b84a0f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/ma-codeEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const props = defineProps({
type: [String, Object, Array],
default: () => ''
},
defaultModelValue: {
type: String,
default: '',
},
valueType: {
type: String,
default: 'value'
Expand Down Expand Up @@ -82,10 +86,9 @@ const initEditorValue = () => {
} else if (props.valueType === 'value' && props.modelValue._onWillDispose === undefined) {
instance.setValue(formatJson(props.modelValue))
} else if (props.modelValue){
console.log(props.modelValue)
instance.setModel(toRaw(props.modelValue))
} else {
instance.setModel(monaco.editor.createModel('', props.language))
instance.setModel(monaco.editor.createModel(props.defaultModelValue, props.language))
}
}

Expand Down

0 comments on commit 1b84a0f

Please sign in to comment.