From c7a037c226a90bebe01debf468ba0434a2a53b8f Mon Sep 17 00:00:00 2001 From: itorr Date: Mon, 15 Aug 2022 13:40:46 +0800 Subject: [PATCH] calcOverflow --- html/document.js | 12 ++++++++++-- html/document.less | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/html/document.js b/html/document.js index c507429..9819187 100644 --- a/html/document.js +++ b/html/document.js @@ -259,6 +259,12 @@ app = new Vue({ this.diff = true; document.activeElement = null; + }, + calcOverflow(){ + const { loading,output } = this; + const hidden = !!(loading || output); + const el = document.documentElement; + el.setAttribute('data-no-scroll',hidden); } }, computed: { @@ -278,12 +284,14 @@ app = new Vue({ handler(){ this._louvre(); } - } + }, + loading:'calcOverflow', + output:'calcOverflow', } }); - +app.calcOverflow(); setTimeout(_=>{ diff --git a/html/document.less b/html/document.less index d9eeed0..0cd80ba 100644 --- a/html/document.less +++ b/html/document.less @@ -223,6 +223,9 @@ input[type="range"]{ } */ h1{ +} +html[data-no-scroll="true"]{ + overflow: hidden; } .ui-shadow{ position: fixed; @@ -233,6 +236,8 @@ h1{ z-index:1; background:rgba(0,0,0,.5); overflow: auto; + overflow-y: scroll; + overscroll-behavior: contain; } .output-box{ background:#FFF;