Files
dns-server/.trae/documents/修复DNS请求趋势图表展开后的响应式问题.md
2025-11-28 17:08:34 +08:00

15 lines
903 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 问题分析
DNS请求趋势图表展开后不能随页面放大缩小自动调整大小。通过代码分析发现`window.addEventListener('resize')`事件监听器只处理了侧边栏的显示/隐藏,没有处理图表的调整大小。
## 解决方案
1. 修改`window.addEventListener('resize')`事件监听器,添加对所有图表(包括详细图表)的更新调用
2. 确保在模态框显示时,图表能够正确响应窗口大小变化
## 修复步骤
1. 打开`/root/dns/static/js/dashboard.js`文件
2. 找到`window.addEventListener('resize')`事件监听器
3. 修改该事件监听器,添加对`dnsRequestsChart``detailedDnsRequestsChart`的更新调用
4. 确保图表实例存在时才调用update方法
## 预期效果
修复后当用户展开DNS请求趋势图表并调整浏览器窗口大小时图表会自动调整大小以适应新的窗口尺寸。