Tue Jun 20 09:07:00 UTC 2023 inscode

上级 4d66faa6
......@@ -4,9 +4,10 @@
<form @submit.prevent="submitForm">
<textarea style="width: 100%;" v-model="inputText" cols="30" rows="10"></textarea>
<br>
<button type="submit">提交</button>
<button type="submit" id="submit">提交</button>
</form>
<textarea style="width: 100%;" name="output" id="" cols="30" rows="10">{{ this.msg.outputText }}</textarea>
<textarea style="width: 100%;" name="output" id="output" cols="30" rows="10">{{ this.msg.outputText }}</textarea>
<button id="btn_copy" onclick="copy()">复制</button>
<textarea v-if="this.msg.error" style="width: 100%;" id="errorMessage" rows="10">{{ this.msg.error }}</textarea>
</div>
</template>
......@@ -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');
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
</script>
<style scoped>
h1,
h2 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册