| | |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="closeHandler">取 消</el-button> |
| | | <el-button type="primary" @click="addOrEditExam">确 定</el-button> |
| | | <el-button type="primary" @click="handleDebouncedClick">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | endTime: null, |
| | | time: [] |
| | | }, |
| | | // 声明一个定时器 |
| | | debounceTimeout: null, |
| | | selectExamPaper: {}, |
| | | examRules: { |
| | | examName: [ |
| | |
| | | this.page() |
| | | this.getMyClasses() |
| | | this.MyExamPaperList() |
| | | this.handleDebouncedClick = this.debounce(this.addOrEditExam, 500); // 500ms的防抖时间 |
| | | }, |
| | | methods: { |
| | | // 作废考试 |
| | |
| | | }, |
| | | handleExamPaperSelect (e) { |
| | | this.selectExamPaper = this.examPaperList.find((o) => o.id === e) |
| | | } |
| | | }, |
| | | // 防抖函数 |
| | | debounce(func, wait) { |
| | | return (...args) => { |
| | | if (this.debounceTimeout) { |
| | | clearTimeout(this.debounceTimeout); |
| | | } |
| | | this.debounceTimeout = setTimeout(() => { |
| | | func.apply(this, args); |
| | | }, wait); |
| | | }; |
| | | }, |
| | | // 防抖处理的点击事件 |
| | | handleDebouncedClick: null, |
| | | } |
| | | } |
| | | </script> |