Skip to content
Merged
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
12 changes: 9 additions & 3 deletions packages/plugins/script/src/js/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const state = reactive({
isChanged: false,
hasError: false,
editorSelection: null,
completionProvider: null
completionProvider: null,
// 记录当前是否已经有弹窗,防止使用 ctrl + s 的时候重复弹窗
hasErrorPopup: false
})

const monaco = ref(null)
Expand Down Expand Up @@ -86,14 +88,18 @@ export const saveMethod = ({ name, content }) => {

const saveMethods = () => {
const { message } = useModal()
if (!state.isChanged) {
if (!state.isChanged || state.hasErrorPopup) {
return false
}

if (state.hasError) {
state.hasErrorPopup = true
message({
status: 'error',
message: '代码静态检查有错误,请先修改后再保存'
message: '代码静态检查有错误,请先修改后再保存',
exec: () => {
state.hasErrorPopup = false
}
})

return false
Expand Down