From 4e83519887e90df0890b07a14831b9aa10f4819d Mon Sep 17 00:00:00 2001 From: 637f075a0567bd2c57c77830 <637f075a0567bd2c57c77830@devide> Date: Tue, 20 Jun 2023 09:07:00 +0000 Subject: [PATCH] Tue Jun 20 09:07:00 UTC 2023 inscode --- index.html | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index ffbf629..b0f3536 100644 --- a/index.html +++ b/index.html @@ -4,9 +4,10 @@

- +
- + + @@ -31,7 +32,7 @@ export default { }); }, methods: { - submitForm() { // 处理提交逻辑 + submitForm() { axios .post("http://localhost:8080/about", { inputText: this.inputText @@ -42,17 +43,27 @@ export default { .catch((err) => { }); }, + handleKeyDown(event) { + console.log('test-key', event.keyCode) + if (event.key === "F5") { + event.preventDefault(); + this.submitForm(); + } + }, + }, + mounted() { + document.addEventListener("keydown", this.handleKeyDown); + }, + beforeDestroy() { + document.removeEventListener("keydown", this.handleKeyDown); }, - }; -document.onkeydown = function (event) { - if (event.key === 'F5') { - event.preventDefault(); - } +function copy() { + document.getElementById("output").select() + document.execCommand('copy'); } - - +