Modify the batch translation button to stop translation when clicked during translation

Former-commit-id: d1306b98c99fb1ddc93e230cf0370ef8398c39f1
This commit is contained in:
Physton
2023-05-21 15:57:09 +08:00
parent 46dd3c162e
commit 15b0ccde2e
3 changed files with 8 additions and 2 deletions

View File

@@ -1 +1 @@
9c068d1d470911810bea124edae4ce5372f70370
f4a9a373b9d941a4f46b8f50c890dbe637bc9afe

View File

@@ -1 +1 @@
29cf5f5b8e25714298cade003f51f052e1d6ef7f
9aa6f92e1d185e959f8591b0372989a7c6ec0300

View File

@@ -178,6 +178,12 @@ export default {
}
for (const index in texts) {
const text = texts[index]
if (this.cancelMultiTranslate) {
// 如果取消了翻译,跳过
callback(this._translateRes(true, '', text, '', from_lang, to_lang, translateApi, translateApiConfig), index)
completeFunc()
continue
}
this.translate(text, from_lang, to_lang, translateApi, translateApiConfig).then(res => {
callback(res, index)
completeFunc()