瀏覽代碼

improve AutoScrollBottom logic

AutoScrollBottom only when set `AutoScrollBottom` and put msg with no `anchor` parameter
wangweimin 5 年之前
父節點
當前提交
15e00dc348
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      pywebio/html/js/form.js

+ 2 - 2
pywebio/html/js/form.js

@@ -134,8 +134,8 @@
         } else if (msg.command === 'output_ctl') {
         } else if (msg.command === 'output_ctl') {
             this.handle_output_ctl(msg);
             this.handle_output_ctl(msg);
         }
         }
-        // note:当接收到scroll_to指令时,忽略AutoScrollBottom
-        if (AutoScrollBottom && !(msg.command === 'output_ctl' && msg.spec.scroll_to !== undefined))
+        // 当设置了AutoScrollBottom、并且不指定锚点进行输出时,滚动到底部
+        if (AutoScrollBottom && msg.command !== 'output_ctl' && msg.spec.before === undefined && msg.spec.after === undefined)
             this.scroll_bottom();
             this.scroll_bottom();
     };
     };