fix: unbind event for login page when the component is unmount

This commit is contained in:
RockYang 2023-11-14 18:19:40 +08:00
parent 998cbace92
commit 64d6bff6d9
6 changed files with 13 additions and 10 deletions

View File

@ -42,7 +42,7 @@ ChatGLM,讯飞星火,文心一言等多个平台的大语言模型。集成了
### 会员充值
![会员充值](/docs/imgs/alipay.png)
![会员充值](/docs/imgs/member.png)
### 自动调用函数插件
@ -437,8 +437,7 @@ make clean linux
如果你觉得这个项目对你有帮助,并且情况允许的话,可以请作者喝杯咖啡,非常感谢你的支持~
![支付宝打赏](docs/imgs/alipay.png)
![微信打赏](docs/imgs/wechat-pay.png)
![打赏](docs/imgs/donate.png)
![Star History Chart](https://api.star-history.com/svg?repos=yangjian102621/chatgpt-plus&type=Date)

View File

@ -1,6 +1,5 @@
version: '3'
services:
# 后端 API 程序
mysql:
image: mysql:8.0.33
container_name: chatgpt-plus-mysql

BIN
docs/imgs/donate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View File

@ -48,7 +48,7 @@
<script setup>
import {onMounted, ref} from "vue";
import {onMounted, onUnmounted, ref} from "vue";
import {Lock, UserFilled} from "@element-plus/icons-vue";
import {httpPost} from "@/utils/http";
import {ElMessage} from "element-plus";
@ -74,12 +74,17 @@ checkSession().then(() => {
}).catch(() => {
})
const handleKeyup = (e) => {
if (e.key === 'Enter') {
login();
}
};
onMounted(() => {
document.addEventListener('keyup', (e) => {
if (e.key === 'Enter') {
login();
}
});
document.addEventListener('keyup', handleKeyup)
})
onUnmounted(() => {
document.removeEventListener('keyup', handleKeyup)
})
const login = function () {