go-admin icon indicating copy to clipboard operation
go-admin copied to clipboard

[BUG]在Panel中增加自动刷新,重复点击右上角的刷新按钮,会导致定时器重复添加

Open trying2016 opened this issue 3 years ago • 0 comments

bug 描述 [详细地描述 bug,让大家都能理解]

在Panel中增加自动刷新,重复点击右上角的刷新按钮,会导致定时器重复添加

复现步骤 [清晰描述复现步骤,让别人也能看到问题]

重复点击右上角的刷新按钮,会导致定时器重复添加

期望结果 [描述你原本期望看到的结果]

复现代码 [提供可复现的代码,仓库,或线上示例]

建议可以加个定时器判断或者是清除已经添加过的定时器 <script> window.setTimeout(function(){ $.pjax.reload('#pjax-container'); }, + template.HTML(strconv.Itoa(refreshTime*1000)) + ); </script>

<script> if(window.refreshTime != null){ clearTimeout(window.refreshTime); } window.refreshTime = window.setTimeout(function(){ $.pjax.reload('#pjax-container'); }, + template.HTML(strconv.Itoa(refreshTime*1000)) + ); </script>

版本信息:

  • GoAdmin 版本:
  • golang 版本:
  • 浏览器环境:
  • 开发环境:

其他信息 [如截图等其他信息可以贴在这里]

trying2016 avatar Jul 16 '21 09:07 trying2016