diff --git a/src/views/archive.vue b/src/views/archive.vue index bf5cd77..dc56177 100644 --- a/src/views/archive.vue +++ b/src/views/archive.vue @@ -47,12 +47,23 @@ const showMenu = () => { } const copyArchive = () => { - navigator.clipboard.writeText(archive.value).then(() => { + if (navigator.clipboard && window.isSecureContext) { + navigator.clipboard.writeText(archive.value).then(() => { + commit('set_sys_info', { msg: t('copyArchive.1'), type: 'win' }) + showMenu(); + }).catch(() => { + commit('set_sys_info', { msg: t('copyArchive.2'), type: 'waring' }) + }); + } else { + const textField = document.createElement("textarea"); + textField.innerText = archive.value; + document.body.appendChild(textField); + textField.select(); + document.execCommand("copy"); + textField.remove(); commit('set_sys_info', { msg: t('copyArchive.1'), type: 'win' }) - }, () => { - commit('set_sys_info', { msg: t('copyArchive.2'), type: 'waring' }) - }); - showMenu(); + showMenu(); + } } const pasteArchive = () => {