fix: 修复上传按钮点击事件冒泡导致面板关闭问题
This commit is contained in:
@@ -231,7 +231,8 @@ function openConversation(id) {
|
|||||||
const fileInput = document.getElementById('fileInput');
|
const fileInput = document.getElementById('fileInput');
|
||||||
|
|
||||||
if (attachBtn) {
|
if (attachBtn) {
|
||||||
attachBtn.addEventListener('click', () => {
|
attachBtn.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation(); // 阻止冒泡到 document
|
||||||
attachPanel.classList.toggle('show');
|
attachPanel.classList.toggle('show');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -239,7 +240,7 @@ function openConversation(id) {
|
|||||||
// 点击其他地方关闭面板
|
// 点击其他地方关闭面板
|
||||||
document.addEventListener('click', (e) => {
|
document.addEventListener('click', (e) => {
|
||||||
if (attachPanel && attachPanel.classList.contains('show') &&
|
if (attachPanel && attachPanel.classList.contains('show') &&
|
||||||
!attachPanel.contains(e.target) && e.target !== attachBtn) {
|
!attachPanel.contains(e.target) && !attachBtn.contains(e.target)) {
|
||||||
attachPanel.classList.remove('show');
|
attachPanel.classList.remove('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
<meta http-equiv="Pragma" content="no-cache">
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
<meta http-equiv="Expires" content="0">
|
<meta http-equiv="Expires" content="0">
|
||||||
<title>AI助手</title>
|
<title>AI助手</title>
|
||||||
<link rel="stylesheet" href="style.css?v=2.1.0">
|
<link rel="stylesheet" href="style.css?v=2.1.1">
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="marked.min.js?v=2.1.0"></script>
|
<script src="marked.min.js?v=2.1.1"></script>
|
||||||
<script src="app.js?v=2.1.0"></script>
|
<script src="app.js?v=2.1.1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user