feat: 防抖处理
This commit is contained in:
parent
56696e7d1d
commit
22c609dfdf
@ -22,7 +22,9 @@
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="text-right p-24 pt-0" v-if="problemId && isEdit">
|
<div class="text-right p-24 pt-0" v-if="problemId && isEdit">
|
||||||
<el-button @click.prevent="cancelEdit"> 取消 </el-button>
|
<el-button @click.prevent="cancelEdit"> 取消 </el-button>
|
||||||
<el-button type="primary" :disabled="loading" @click="submitHandle"> 保存 </el-button>
|
<el-button type="primary" :disabled="loading" @click="handleDebounceClick">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" class="border-l">
|
<el-col :span="8" class="border-l">
|
||||||
@ -38,7 +40,9 @@
|
|||||||
<template #footer v-if="!problemId">
|
<template #footer v-if="!problemId">
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
|
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
|
||||||
<el-button :disabled="loading" type="primary" @click="submitHandle"> 提交 </el-button>
|
<el-button :disabled="loading" type="primary" @click="handleDebounceClick">
|
||||||
|
提交
|
||||||
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -46,7 +50,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, nextTick } from 'vue'
|
import { ref, watch, nextTick } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep, debounce } from 'lodash'
|
||||||
|
|
||||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||||
import paragraphApi from '@/api/paragraph'
|
import paragraphApi from '@/api/paragraph'
|
||||||
@ -138,6 +143,9 @@ const submitHandle = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const handleDebounceClick = debounce(() => {
|
||||||
|
submitHandle()
|
||||||
|
}, 200)
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user