Skip to content

Commit

Permalink
添加超时判断
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed Feb 25, 2024
1 parent bb822a4 commit ac3a529
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const container = document.querySelector('.container')
// 提交函数
async function generateImage() {
try {
// 设置超时
setTimeout(() => {
throw new Error('请求超时')
}, 30000)
// 禁用按钮
submit.disabled = true
submit.textContent = '生成中...'
Expand Down

0 comments on commit ac3a529

Please sign in to comment.